index rss mastodon twitter github linkedin email
Álvaro Ramírez

Álvaro Ramírez

24 February 2019 Copy from desktop to mobile via QR code

Marcin Borkowski has a nice tip to quickly copy text or URLs between desktop and mobile using QR codes.

Wrote a little elisp to do a similar thing using the clipboard via Emacs:

(defun ar/misc-clipboard-to-qr ()
  "Convert text in clipboard to qrcode and display within Emacs."
  (let ((temp-file (concat (temporary-file-directory) "qr-code")))
    (if (eq 0 (shell-command (format "qrencode -s10 -o %s %s"
                                     (shell-quote-argument (current-kill 0)))
        (switch-to-buffer (find-file-noselect temp-file t))
      (error "Error: Could not create qrcode, check *qrencode* buffer"))))


ps. Encoding your WiFi access point password into a QR code shows how to encode WiFi access point passwords:

qrencode -o wifi.png "WIFI:T:WPA;S:<SSID>;P:<PASSWORD>;;"

More comprehensively:

pwgen -s 63 > 00wifi.txt
qrencode -o 00wifi.png "WIFI:T:WPA;S:${SSID};P:$(cat 00wifi.txt);;"