New scrip to live ocr screeshot to the clipboard
This commit is contained in:
16
scripts/scrot-ocr.sh
Executable file
16
scripts/scrot-ocr.sh
Executable file
@@ -0,0 +1,16 @@
|
||||
#!/bin/bash
|
||||
scrot-ocr: Select screen region → OCR → clipboard
|
||||
Deps: grim, slurp, tesseract, wl-clipboard, libnotify
|
||||
set -euo pipefail
|
||||
|
||||
LANG="${1:-eng}"
|
||||
IMG="/tmp/scrot-ocr-$(date +%s).png"
|
||||
|
||||
grim -g "$(slurp -d)" "$IMG"
|
||||
TEXT=$(tesseract "$IMG" stdout -l "$LANG" 2>/dev/null | sed '/^[[:space:]]*$/d')
|
||||
|
||||
echo -n "$TEXT" | wl-copy --paste-once
|
||||
echo "$TEXT"
|
||||
|
||||
notify-send "scrot-ocr" "$(echo "$TEXT" | wc -l) lines copied to clipboard" -t 3000
|
||||
rm -f "$IMG"
|
||||
Reference in New Issue
Block a user