I often want to copy URLs or text or other data from my laptop/desktop on a phone. Sometimes it’s my own phone, sometimes it’s someone else’s phone, and sometimes it’s a phone that isn’t even set up yet.
My solution works as follows:
- I copy into my CLIPBOARD selection the data that I want to transfer.
- From my launcher, I pick an entry to render clipboard as a QR code.
- I scan the QR code from the phone.
This is convenient and globally accessible. It requires not connectivity between the devices; only line of sight.
Implementation
I created the following desktop entry in
~/.local/share/applications/clip2qr.desktop
so it shows up in my launcher,
fuzzel
:
[Desktop Entry]
Version=1.0
Name=QR code for CLIPBOARD selection
TryExec=qrencode
Exec=sh -c "wl-paste | qrencode -s 30 -o - | imv -"
Icon=terminal
Keywords=qr;clipboard;selection
Type=Application
Terminal=false
This will pipe the clipboard into qrencode
using wl-paste
, and then render
the image using imv
. I can then scan it on the phone.
My launcher does fuzzy matching, so just typing qr
shows my entry shows up as
the first result. The whole sequence of keys is Super+d
q r Return 1.
Dependencies
The necessary software can be installed on Alpine Linux with
apk add wl-clipboard libqrencode-tools imv
.
Super+d is my mapping to open the launcher. ↩︎