added clipboard-to-qr.sh

This commit is contained in:
Tobias Schmidl 2022-03-31 17:15:31 +02:00
parent 9978badbad
commit 23733e2d2c

19
.local/bin/clipboard-to-qr.sh Executable file
View file

@ -0,0 +1,19 @@
#! /bin/bash
if [ "$XDG_SESSION_TYPE" = "wayland" ];
then
CLIPBOARD_STRING=$(wl-paste)
elif [ "$XDG_SESSION_TYPE" = "x11" ];
then
CLIPBOARD_STRING=$(xclip -s c -o)
else
echo "This script needs *either* wayland *or* X11 running." >&2
exit 1
fi
if [ "$1" = "-console" ];
then
qrencode -8 -l M -t ANSI256UTF8 "$CLIPBOARD_STRING"
else
qrencode -d 96 -8 -l M -o - "$CLIPBOARD_STRING" | feh -ZF --force-aliasing -
fi