Last active
May 16, 2023 11:44
-
-
Save Konfekt/72ab6841a37fb81f1f4ae32f8fb3e4b4 to your computer and use it in GitHub Desktop.
xbindkeys bindings to copy recognized (OCRed) text of rectangular selection or current window to clipboard (similar to Text Extractor of Powertoys under Microsoft Windows)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Uses ksnip to select a rectangular region. Other options, instead of | |
# | |
# ksnip --rectarea --saveto "$file" | |
# | |
# are | |
# | |
# - spectacle --background --region --output "$file" | |
# - xfce4-screenshooter --region --mouse --save "$file" | |
# - maim --select --hidecursor --quiet "$file" | |
"file="${TMPDIR:-/tmp}/ocr-$(date '+%Y-%m-%d_%H:%M:%S').png"; ksnip --rectarea --saveto "$file"; tesseract -c debug_file=/dev/null -l eng+deu "$file" - | xsel --input --clipboard && rm "$file"; notify-send --expire-time=1000 --urgency=normal "copied recognized text of selected rectangular region to clipboard"" | |
Shift + Print | |
# Uses ksnip to take a shot of the active window. Other options, instead of | |
# | |
# ksnip --active --saveto "$file" | |
# | |
# are | |
# | |
# - spectacle --background --activewindow --output "$file" | |
# - xfce4-screenshooter --window --mouse --save "$file" | |
# - maim --window=$(xdotool getactivewindow) --hidecursor --quiet "$file" | |
# | |
# where the last option Maim depends on xdotool. | |
"file="${TMPDIR:-/tmp}/ocr-$(date '+%Y-%m-%d_%H:%M:%S').png"; ksnip --active --saveto "$file"; tesseract -c debug_file=/dev/null -l eng+deu "$file" - | xsel --input --clipboard && rm "$file"; notify-send --expire-time=1000 --urgency=normal "copied recognized text of active window to clipboard"" | |
Control + Shift + Print |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment