Last active
January 28, 2022 13:56
-
-
Save cpbotha/fdd2c5ab3d22a33679c546323ea3bc0b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; as of 2021-12-19 with latest master pgtk emacs on non-store WSL I can copy | |
;; text from other apps into Emacs, but I can't copy text from Emacs into other | |
;; apps, and so I use this work-around with wl-copy. | |
;; original value of interprogram-cut-function was gui-select-text. | |
;; you need to have the wl-clipboard package installed for the wl-copy tool. | |
;; update 2022-01-28: this work-around still required with WSL 0.51.2.0 | |
(when (getenv "WAYLAND_DISPLAY") | |
(setq | |
interprogram-cut-function | |
(lambda (text) | |
;; strangest thing: gui-select-text leads to gui-set-selection 'CLIPBOARD | |
;; text -- if I eval that with some string, it mostly lands on the wayland | |
;; clipboard, but not when it's invoked from this context. | |
;; (gui-set-selection 'CLIPBOARD text) | |
;; without the charset=utf-8 in type, emacs / wl-copy will crash when you paste emojis into a windows app | |
(start-process "wl-copy" nil "wl-copy" "--trim-newline" "--type" "text/plain;charset=utf-8" text)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment