dotfiles

personal dotfiles
git clone anongit@rnpnr.xyz:dotfiles.git
Log | Files | Refs | Feed | Submodules

Commit: fe3df1e5e38d8f84939a73bcd1a2016e94721f71
Parent: d5a3e91bb3202c5a8d7da49c2549d5b8f16cc647
Author: Randy Palamar
Date:   Fri, 14 Jul 2023 22:27:44 -0600

bin/{ocr,screenshot}: replace slop/imagemagick with sx4/sxot

Diffstat:
Mbin/ocr | 7++++---
Mbin/screenshot | 12++++++------
2 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/bin/ocr b/bin/ocr @@ -1,7 +1,7 @@ #!/bin/sh # copy text from an image to the clipboard -# deps: imagemagick tesseract slop xclip +# deps: tesseract sxot sx4 xclip # you probably want the jpn.traineddata or jpn_vert.traineddata from here: # https://github.com/tesseract-ocr/tessdata # or the capture2text one here: @@ -9,7 +9,8 @@ TESS_DATA="$HOME/.local/share/tesseract" -usage() { +usage() +{ echo "usage: ocr [-l lang][-d dpi]" exit 1 } @@ -25,7 +26,7 @@ done lang=${lang:-jpn} dpi=${dpi:-96} -import -window root -crop $(slop -f '%g') png:- | +sxot -g "$(sx4)" | tesseract stdin stdout \ --dpi $dpi -l $lang \ --tessdata-dir "$TESS_DATA" | diff --git a/bin/screenshot b/bin/screenshot @@ -16,17 +16,17 @@ OCR" case $(echo "$options" | dmenu -i -l 7 -p "Screenshot: ") in "area (copy)") - import -window root -crop $(slop -f '%g') png:- | ${clip_cmd} ;; + sxot -g "$(sx4)" | optipng-pipe | ${clip_cmd} ;; "current window (copy)") - import -window "$(xdotool getactivewindow)" png:- | ${clip_cmd} ;; + sxot -g "$(sx4 -w "$(xdotool getactivewindow)")" | optipng-pipe | ${clip_cmd} ;; "full screen (copy)") - import -window root png:- | ${clip_cmd} ;; + sxot | optipng-pipe | ${clip_cmd} ;; "area") - import -window root -crop $(slop -f '%g') "sel-$output" ;; + sxot -g "$(sx4)" | optipng-pipe > "sel-${output}" ;; "current window") - import -window "$(xdotool getactivewindow)" "win-$output" ;; + sxot -g "$(sx4 -w "$(xdotool getactivewindow)")" | optipng-pipe > "win-${output}" ;; "full screen") - import -window root "full-$output" ;; + sxot | optipng-pipe > "full-${output}" ;; "OCR") ocr ;; esac