scripts reorganize

This commit is contained in:
djaidjai committed 2026-10-06 22:34:05 +02:00
1 parent a2a056a68d
commit 0734bee219
60 files changed
+824 -5

No files matched your search

+36
View File
@@ -0,0 +1,36 @@
#!/usr/bin/env bash
# This script allows the user to make a selection, then runs that selection through OCR and copies the result to clipboard
case "$XDG_SESSION_TYPE" in
"wayland")
copy="wl-copy"
screenshot="grim -g"
slop=$(slurp -f "%x,%y %wx%h") || exit 1
;;
"x11")
copy="xclip -selection c"
screenshot="import -window root -crop "
slop=$(slop -f "%G") || exit 1
;;
*)
dunstify -t 2000 -u low -i ~/.icons/candy-icons/apps/scalable/code.svg "Current session type not supported by tess.sh"
exit
;;
esac
# files
imagefile="/tmp/tesseract.$RANDOM.png"
text="/tmp/translation"
# get screenshot
read -r G <<< "$slop"
bash -c "$screenshot \"$G\" $imagefile"
# OCR, save to clipboard
tesseract $imagefile $text 2>/dev/null
cat "$text.txt" | bash -c "$copy"
# cleanup
rm $text".txt"
rm "$imagefile"
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.