]> Sergey Matveev's repositories - dotfiles.git/commitdiff
Ability to screenshot without uploading
authorSergey Matveev <stargrave@stargrave.org>
Thu, 16 Mar 2023 15:11:12 +0000 (18:11 +0300)
committerSergey Matveev <stargrave@stargrave.org>
Thu, 16 Mar 2023 15:11:12 +0000 (18:11 +0300)
bin/bin/mkss

index dfe03a33632a1bf38f749621340d067fd4a221a0..a276498b21e743112020b74b3f22a6faca5eabc2 100755 (executable)
@@ -3,8 +3,17 @@
 sleep 1
 tmp=`mktemp`
 trap "rm -f $tmp $tmp.png $tmp.webp $tmp.txt" HUP PIPE INT QUIT TERM EXIT
-[ "$1" = "root" ] && root="-window root" || root=""
+[ "$1" = "root" ] && {
+    root="-window root" || root=""
+    shift
+}
 import $root $tmp.png
 my-cwebpl -o $tmp.webp $tmp.png
-paster $tmp.webp > $tmp.txt
+if [ "$1" = no ]; then
+    fn=/tmp/`dd if=/dev/urandom bs=8 count=1 2>/dev/null | xxd -p`.webp
+    mv $tmp.webp $fn
+    echo $fn | tee $tmp.txt
+else
+    paster $tmp.webp > $tmp.txt
+fi
 xmessage -file $tmp.txt