about summary refs log tree commit diff
path: root/pkgs/profpatsch/show-qr-code/default.nix
blob: 229d5adabc6db2e048a2896abdce9c183f77effc (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
{ stdenv, writeScriptBin, gtkdialog, qrencode }:

let script = writeScriptBin "show-qr-code" ''
  #!/bin/sh
  TMP=$(mktemp)
  trap 'rm "$TMP"' EXIT
  ${qrencode}/bin/qrencode -s 8 -o "$TMP" -t PNG

  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";
  };
}