scripts: add script to read QR codes

This commit is contained in:
Leonardo Eugênio 2024-03-27 12:40:22 -03:00
parent 08d66a4053
commit a3e77a9661
4 changed files with 29 additions and 0 deletions

View file

@ -50,6 +50,7 @@ create_scripts
color_picker = [ grim slurp wl-clipboard libnotify imagemagick ]; color_picker = [ grim slurp wl-clipboard libnotify imagemagick ];
dzadd = [ procps libnotify final.wdmenu jq mpv pqiv python3Packages.deemix mpc-cli final.mpdDup ]; dzadd = [ procps libnotify final.wdmenu jq mpv pqiv python3Packages.deemix mpc-cli final.mpdDup ];
mpdDup = [ mpc-cli perl ]; mpdDup = [ mpc-cli perl ];
readQrCode = [ grim zbar wl-clipboard ];
} // lib.mapAttrs import_script { } // lib.mapAttrs import_script {
wdmenu = ./wdmenu.nix; wdmenu = ./wdmenu.nix;
wlauncher = ./wlauncher.nix; wlauncher = ./wlauncher.nix;

18
scripts/readQrCode Executable file
View file

@ -0,0 +1,18 @@
#!/bin/sh
set -o pipefail
main() {
if wl-paste | zbarimg -q --raw - | wl-copy
then
notify-send "Copied" "QrCode was copied to clipboard"
rm "$LOGFILE"
else
notify-send "Failed to read QrCode" "Log file is '$LOGFILE'"
fi
}
LOGFILE=$(mktemp /tmp/qrcode-XXXXXXXX.log)
main > "$LOGFILE" 2>&1

View file

@ -54,5 +54,14 @@
icon = "download"; icon = "download";
categories = [ "Network" ]; categories = [ "Network" ];
}; };
readQrCode = {
name = "Read QR Code";
genericName = "Read QR Code from clipboard image";
exec = "readQrCode";
terminal = true;
type = "Application";
icon = "download";
categories = [ "Network" ];
};
}; };
} }

View file

@ -20,6 +20,7 @@
wpass wpass
_gpg-unlock _gpg-unlock
qtpass qtpass
readQrCode
]; ];
}; };
} }