From 80fed34e09a841f0a4907b8311f6a997beebc544 Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Fri, 5 May 2023 00:04:20 -0300 Subject: Feat: qrpaste: support for content in the command line, falling back to clipboard --- qrpaste | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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 -- cgit v1.2.3