Skip to content

Instantly share code, notes, and snippets.

@rcky844
Created February 1, 2025 09:51
Show Gist options
  • Save rcky844/286a8b424e8233468829816a6adb69b7 to your computer and use it in GitHub Desktop.
Save rcky844/286a8b424e8233468829816a6adb69b7 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
TMPFILE=$(mktemp)
trap 'rm -f "$TMPFILE"' EXIT
spectacle -r -o $TMPFILE -b -n 2>/dev/null
if [ -f "$TMPFILE" ]; then
export OMP_THREAD_LIMIT=1
if [ "$XDG_SESSION_TYPE" = "x11" ]; then
tesseract $TMPFILE - --oem 1 | xclip -selection clipboard
fi
if [ "$XDG_SESSION_TYPE" = "wayland" ]; then
tesseract $TMPFILE - --oem 1 | wl-copy
fi
kdialog --passivepopup "OCR finished" 7 --title "OCR"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment