diff options
author | Profpatsch <mail@profpatsch.de> | 2015-12-27 22:19:01 +0100 |
---|---|---|
committer | Profpatsch <mail@profpatsch.de> | 2015-12-27 22:30:49 +0100 |
commit | 843eba128cb16b37ca8b297eb5ff6c61349e7883 (patch) | |
tree | ffcae86cda1c3c4a1db9b3baa22bc207d6d221e8 /pkgs/show-qr-code/default.nix | |
parent | 4840c13b14c0a5a1792b5dca968efef6db45ec60 (diff) |
pkgs: show-qr-code
Diffstat (limited to 'pkgs/show-qr-code/default.nix')
-rw-r--r-- | pkgs/show-qr-code/default.nix | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/pkgs/show-qr-code/default.nix b/pkgs/show-qr-code/default.nix new file mode 100644 index 00000000..17d9847a --- /dev/null +++ b/pkgs/show-qr-code/default.nix @@ -0,0 +1,28 @@ +{ stdenv, writeScriptBin, gtkdialog, qrencode }: + +let script = writeScriptBin "show-qr-code" '' + #!/bin/sh + TMP=$(mktemp) + ${qrencode}/bin/qrencode -s 8 -o "$TMP" -t PNG "$1" + + export DIALOG=' + <vbox> + <pixmap> + <input file>'$TMP'</input> + </pixmap> + </vbox> + ' + + ${gtkdialog}/bin/gtkdialog --program=DIALOG > /dev/null & + + sleep 0.2 + + rm "$TMP" + + ''; + +in script // { + meta = { + description = "Show the given string as qr code in a gtk window"; + }; +} |