summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorRaymaekers Luca <raymaekers.luca@gmail.com>2023-04-22 15:01:17 +0200
committerRaymaekers Luca <raymaekers.luca@gmail.com>2023-04-22 15:01:17 +0200
commit64df755cb58833e05c899f97ef7bb363c44f2391 (patch)
treeaa5f6e843588e407936682b83e943b34a2ba8eef /bin
parent7807010408107049fac497e0b5151d137d4f3c35 (diff)
added imgclip
Diffstat (limited to 'bin')
-rwxr-xr-xbin/guiscripts/imgclip23
1 files changed, 23 insertions, 0 deletions
diff --git a/bin/guiscripts/imgclip b/bin/guiscripts/imgclip
new file mode 100755
index 0000000..710770b
--- /dev/null
+++ b/bin/guiscripts/imgclip
@@ -0,0 +1,23 @@
+#!/bin/sh
+
+tmppic="/tmp/imgclip.png"
+if [ "$WAYLAND_DISPLAY" ]
+then
+ clipo='wl-paste'
+ clipp='wl-copy'
+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>"