about summary refs log tree commit diff
path: root/pkgs/show-qr-code
diff options
context:
space:
mode:
authorProfpatsch <mail@profpatsch.de>2015-12-27 22:19:01 +0100
committerProfpatsch <mail@profpatsch.de>2015-12-27 22:30:49 +0100
commit843eba128cb16b37ca8b297eb5ff6c61349e7883 (patch)
treeffcae86cda1c3c4a1db9b3baa22bc207d6d221e8 /pkgs/show-qr-code
parent4840c13b14c0a5a1792b5dca968efef6db45ec60 (diff)
pkgs: show-qr-code
Diffstat (limited to 'pkgs/show-qr-code')
-rw-r--r--pkgs/show-qr-code/default.nix28
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";
+  };
+}