Transfer your computers clipboard to a camera-enable mobile device via QR code

A useful tip showed up for me today on Twitter:

Transfer your PC clipboard to a nearby mobile device:

xclip -o -s c | qrencode -o - | feh --force-aliasing -ZF -

I didn’t have feh installed, but that was quickly fixed (once I’d read up on what feh was):

sudo apt install feh -y

(I already had qrencode installed.)

I was not sure if it would work in Wayland, but it does.

xclip -o -s c | qrencode -o - | feh --force-aliasing -ZF -

Pop it into your ~/.bashrc file, to give it a handy alias:

qrclip () {
xclip -o -s c | qrencode -o - | feh --force-aliasing -ZF -
}

then reload your ~/.bashrc file (or else log out and back in again):

source ~/.bashrc

And, whenever you want to transfer the text on your clipboard to another device with a camera, jumping across a network air gap, you just need to run qrclip on your computer, and then take a photo with / use a QR code scanner on the device with a camera.