Dark minimalist setup for a sysadmin workstation: rounded blur windows with the DMS pink accent, keyboard-driven SSH hub (Mod+S), run-or-raise app binds, Alt+Tab window switching, OCR of screen regions, hotkey cheatsheet, DMS network-editor plugin and the systemd session target for portals. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
14 lines
801 B
Bash
Executable File
14 lines
801 B
Bash
Executable File
#!/bin/bash
|
|
# Select a screen region, OCR it (English + Russian) and put the text in the clipboard.
|
|
if ! command -v tesseract >/dev/null; then
|
|
notify-send -a ocr "OCR" "tesseract is not installed:\nsudo dnf install tesseract tesseract-langpack-eng tesseract-langpack-rus"
|
|
exit 1
|
|
fi
|
|
geom=$(slurp -b 00000066 -c e91e63ff -w 2) || exit 0
|
|
img() { grim -g "$geom" -; }
|
|
if command -v magick >/dev/null; then img() { grim -g "$geom" - | magick png:- -resize 200% -colorspace Gray png:-; }; fi
|
|
text=$(img | tesseract stdin stdout -l eng+rus --psm 6 2>/dev/null | sed 's/[[:space:]]*$//')
|
|
[ -z "$text" ] && { notify-send -a ocr "OCR" "nothing recognised"; exit 1; }
|
|
printf '%s' "$text" | wl-copy
|
|
notify-send -a ocr "Copied $(printf '%s\n' "$text" | wc -l) line(s)" "$(printf '%s\n' "$text" | head -2)"
|