diff options
-rwxr-xr-x | bin/guiscripts/imgclip | 26 |
1 files changed, 4 insertions, 22 deletions
diff --git a/bin/guiscripts/imgclip b/bin/guiscripts/imgclip index 466f2c6..eeac050 100755 --- a/bin/guiscripts/imgclip +++ b/bin/guiscripts/imgclip @@ -1,23 +1,5 @@ #!/bin/sh - -tmppic="/tmp/imgclip.png" -if [ "$WAYLAND_DISPLAY" ] -then - clipo='wl-paste -n' - clipp='wl-copy -n' -else - clipo='xclip -o -selection clipboard -r' - clipp='xclip -selection clipboard -r' -fi - -$clipo > $tmppic 2>/dev/null -ftype="$(file /tmp/imgclip.png -bi | cut -f 1 -d ';')" -if [ "$ftype" != image/png ] -then - notify-send "$(basename $0)" "Not an image." - exit 1 -fi - -tesseract "$tmppic" stdout | $clipp - -notify-send "$(basename $0)" "<i>$($clipo)</i>" +text="$(clipo | tesseract - stdout | sed '/^$/d')" +[ $? -gt 0 ] && exit 1 +choice="$(printf -- "-\n%s" "$text" | commander -cl)" +[ "$choice" ] && printf "%s" "$text" | clipp |