summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Bruhin <me@the-compiler.org>2020-12-02 10:41:36 +0100
committerFlorian Bruhin <me@the-compiler.org>2020-12-02 10:41:36 +0100
commit6c42f977814a3bfe937235b269bb80a5ba81a7a5 (patch)
tree502380b4c19322bf484038f1afd490190777ad48
parent6e285f857eba2c54eb156744833eb1988e1a253a (diff)
downloadqutebrowser-6c42f977814a3bfe937235b269bb80a5ba81a7a5.tar.gz
qutebrowser-6c42f977814a3bfe937235b269bb80a5ba81a7a5.zip
Add QR userscript
-rw-r--r--misc/userscripts/README.md2
-rwxr-xr-xmisc/userscripts/qr8
2 files changed, 10 insertions, 0 deletions
diff --git a/misc/userscripts/README.md b/misc/userscripts/README.md
index fb38839d5..54b0e8e1a 100644
--- a/misc/userscripts/README.md
+++ b/misc/userscripts/README.md
@@ -32,6 +32,8 @@ The following userscripts are included in the current directory.
- [tor_identity](./tor_identity): Change your tor identity.
- [view_in_mpv](./view_in_mpv): Views the current web page in mpv using
sensible mpv-flags.
+- [qr](./qr): Show a QR code for the current webpage via
+ [qrencode](https://fukuchi.org/works/qrencode/).
[castnow]: https://github.com/xat/castnow
[youtube-dl]: https://rg3.github.io/youtube-dl/
diff --git a/misc/userscripts/qr b/misc/userscripts/qr
new file mode 100755
index 000000000..6b935beda
--- /dev/null
+++ b/misc/userscripts/qr
@@ -0,0 +1,8 @@
+#!/bin/bash
+
+pngfile=$(mktemp --suffix=.png)
+trap 'rm -f "$pngfile"' EXIT
+
+qrencode -t PNG -o "$pngfile" -s 10 "$QUTE_URL"
+echo ":open -t file:///$pngfile" >> "$QUTE_FIFO"
+sleep 1 # give qutebrowser time to open the file before it gets removed