diff --git a/.local/bin/clipboard-to-qr.sh b/.local/bin/clipboard-to-qr.sh new file mode 100755 index 0000000..94467f9 --- /dev/null +++ b/.local/bin/clipboard-to-qr.sh @@ -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