Author

Topic: Ubuntu - QR Code Handy Utils (Read 2554 times)

hero member
Activity: 784
Merit: 1009
firstbits:1MinerQ
July 02, 2011, 04:08:57 AM
#1
Here's some handy info if you want to play with scanning QR codes in Ubuntu.
I know there's probably a gui app but this has it's uses too. It's quick once setup and can be automated easily.

Get some needed packages,

sudo apt-get install zbar-tools
sudo apt-get install xclip

Command to scan a QR and put on clipboard, ready to paste,

zbarimg -q --raw "$1" |xclip -selection c

Command to scan using webcam and put on clipboard - this one puts up a preview and when the green square is good press "space", and close window (X). (Better if it auto-closed...)

zbarcam --raw |xclip -selection c

I put these together into a tiny script that does both depending on file parm given,
Code:
#!/bin/bash

if [ -n "$1" ]; then
  zbarimg -q --raw "$1" |xclip -selection c
else
  zbarcam --raw |xclip -selection c
fi

Now you can attach this script to a menu item, or key or desktop shortcut easily.

For capturing a file you can attach it to a Nautilus Action file selected file as parm (%f) and it will allow you to right click any image to convert. I'd suggest adding a couple mime-type selectors  so it only shows for png and jpeg files, not all of them.

Jump to: