New scrip to live ocr screeshot to the clipboard

This commit is contained in:
2026-06-08 16:14:26 -04:00
parent 05a3a8546c
commit 8e9204bc21

16
scripts/scrot-ocr.sh Executable file
View 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"