index all rss twitter github linkedin email

Á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"))))