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 ];
dzadd = [ procps libnotify final.wdmenu jq mpv pqiv python3Packages.deemix mpc-cli final.mpdDup ];
mpdDup = [ mpc-cli perl ];
readQrCode = [ grim zbar wl-clipboard ];
} // lib.mapAttrs import_script {
wdmenu = ./wdmenu.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";
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
_gpg-unlock
qtpass
readQrCode
];
};
}