Clipboard to QR code in console

Here’s a script to show a QR code of your clipboard in Linux. I regularly use it to move text to my smartphone.

#!/bin/bash
FILE=`tempfile -p qr- -s .png`
xsel -b -o | qrencode -o $FILE
echo Contents:
xsel -b -o
echo
echo 'Showing the QR code, press <ESC> to exit.'
display $FILE

This requires ImageMagick and Ubuntu packages qrencode and xsel to be installed.

Screenshot of qrclip in action

On my Android, scanning it automatically puts it in the phone’s clipboard.