teach emacs to use wl-copy
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
(setq wl-copy-process nil) | |
(defun wl-copy (text) | |
(setq wl-copy-process (make-process :name "wl-copy" | |
:buffer nil | |
:command '("wl-copy" "-f" "-n") | |
:connection-type 'pipe)) | |
(process-send-string wl-copy-process text) | |
(process-send-eof wl-copy-process)) | |
(defun wl-paste () | |
(if (and wl-copy-process (process-live-p wl-copy-process)) | |
nil ; should return nil if we're the current paste owner | |
(shell-command-to-string "wl-paste -n | tr -d \r"))) | |
(setq interprogram-cut-function 'wl-copy) | |
(setq interprogram-paste-function 'wl-paste) |
I'm now using emacs-pgtk, which has native wayland support. It's in https://github.com/nix-community/emacs-overlay
@yorickvP I am using emacs-pgtk, but pasting into emacs still doesn't work a lot of the time.
The value of (gui-selection-value)
is different from the wl-paste
output.
Your snippet works
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi, thanks for that!
From my emacs (using emacsclient in alacritty terminal) I need to set WAYLAND_DISPLAY variable to get this working.
M-x setenv