blob: bf4b19f2cc6b1f01b83a63fb3974489c58f619ed (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
{ stdenv, writeScriptBin, gtkdialog, qrencode }:
let script = writeScriptBin "show-qr-code" ''
#!/bin/sh
TMP=$(mktemp)
trap 'rm "$TMP"' EXIT
if [ "$1" = "" ]; then
# read from stdin
${qrencode}/bin/qrencode -s 8 --8bit -o "$TMP" -t PNG
else
# read from first arg
${qrencode}/bin/qrencode -s 8 -o "$TMP" -t PNG "$1"
fi
export DIALOG='
<vbox>
<pixmap>
<input file>'$TMP'</input>
</pixmap>
</vbox>
'
${gtkdialog}/bin/gtkdialog --program=DIALOG > /dev/null &
sleep 0.2
'';
in script // {
meta = {
description = "Show the given string as qr code in a gtk window";
};
}
|