scripts: add script to read QR codes
This commit is contained in:
		
							parent
							
								
									08d66a4053
								
							
						
					
					
						commit
						a3e77a9661
					
				
					 4 changed files with 29 additions and 0 deletions
				
			
		| 
						 | 
				
			
			@ -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
									
								
							
							
						
						
									
										18
									
								
								scripts/readQrCode
									
										
									
									
									
										Executable 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
 | 
			
		||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue