aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2023-05-05 00:04:20 -0300
committerSilvio Rhatto <rhatto@riseup.net>2023-05-05 00:04:20 -0300
commit80fed34e09a841f0a4907b8311f6a997beebc544 (patch)
tree14cfea8f4a9c6dcb625cf506759fcf9c0774df4d
parent8b05c2ffd911b83bee7bd3eefe187ed057f0ebdf (diff)
downloadutils-x11-80fed34e09a841f0a4907b8311f6a997beebc544.tar.gz
utils-x11-80fed34e09a841f0a4907b8311f6a997beebc544.tar.bz2
Feat: qrpaste: support for content in the command line, falling back to clipboard
-rwxr-xr-xqrpaste10
1 files changed, 9 insertions, 1 deletions
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