From: Silvio Rhatto Date: Fri, 5 May 2023 03:04:20 +0000 (-0300) Subject: Feat: qrpaste: support for content in the command line, falling back to clipboard X-Git-Url: https://gitweb.fluxo.info/?a=commitdiff_plain;h=80fed34e09a841f0a4907b8311f6a997beebc544;p=utils-x11.git Feat: qrpaste: support for content in the command line, falling back to clipboard --- diff --git a/qrpaste b/qrpaste index 889bd17..6a30e4d 100755 --- a/qrpaste +++ b/qrpaste @@ -8,6 +8,7 @@ BASENAME="`basename $0`" TEMP="`mktemp -d`" OUT="$TEMP/clipboard.png" SIZE="15" +ARGS="$*" # Check if ! which qrencode &> /dev/null; then @@ -21,8 +22,15 @@ elif ! which display &> /dev/null; then exit 1 fi +# Grab the content +if [ ! -z "$ARGS" ]; then + CONTENT="$ARGS" +else + CONTENT="`xclip -o`" +fi + # Run -qrencode -o "$OUT" "`xclip -o`" -s $SIZE +qrencode -o "$OUT" "$CONTENT" -s $SIZE display $OUT # Teardown