From 8f94668741384c206328c1abce939a6f711ba874 Mon Sep 17 00:00:00 2001 From: Profpatsch Date: Tue, 26 Oct 2021 20:43:42 +0200 Subject: machines/shiki: add read-qr-code --- pkgs/profpatsch/read-qr-code.nix | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 pkgs/profpatsch/read-qr-code.nix (limited to 'pkgs/profpatsch/read-qr-code.nix') diff --git a/pkgs/profpatsch/read-qr-code.nix b/pkgs/profpatsch/read-qr-code.nix new file mode 100644 index 00000000..bc4684c1 --- /dev/null +++ b/pkgs/profpatsch/read-qr-code.nix @@ -0,0 +1,26 @@ +{ stdenv, writeExecline, getBins, zbar, libnotify, imagemagick }: + +let + bins = getBins zbar [ "zbarimg" ] + // getBins imagemagick [ "import" ] + // getBins libnotify [ "notify-send" ]; + + script = writeExecline "read-qr-code" {} [ + "backtick" "-iE" "qrcontent" [ + "pipeline" [ + bins.import "png:-" + ] + bins.zbarimg + "-Sdisable" + "-Sqrcode.enable" + "--raw" + "-" + ] + bins.notify-send "$qrcontent" + ]; + +in script // { + meta = { + description = "Capture a screenshot, then display the content of the QR code, if any"; + }; +} -- cgit 1.4.1