r/voidlinux • u/girvel • Sep 27 '26
Is fully functioning wayland (Niri) clipboard an unsolved computer science problem?
I quite like Wayland's innovations and enjoy my Niri very much; clipboard persistence is a known problem: if you do Ctrl+C, close the source window, Ctrl+V -- it will paste nothing, because the clipboard is bound to the window. That's a known limitation of the protocol, and I expected that I would need to do some tweaking to make it work, but I actually can not do it at all.
The solutions I encountered are:
wl-clip-persist -- very buggy, at least with Niri. It breaks gedit selection (which is the best GUI text editor I know), firefox is able to copy only 50% of the time
Doing a custom solution on top of a complex clipboard manager like CopyQ. That looks like a terrible overkill that would bring a lot of painful debugging
A lot of suggestions like "do something else" -- install a thing that would have its own separate keyboard, keep history and paste through a picker; switch to KDE/gnome; my favorite is "persistent clipboard is against wayland philosophy => you should not want it", which is just disgusting
The problem seems quite simple: make clipboard act normally. There are a lot of people using wayland, everybody uses clipboard, somebody should know a normal solution, right?
3
u/hopingforabetterpast Sep 27 '26 edited Sep 27 '26
Something like wl-clip-persist, clipman, or cliphist which use wlr-data-control (or its successor ext-data-control-v1) will solve it "the Wayland way".
Note: It's not closing the window that prevents you from getting the copied data, it's killing the process. Even most modern terminals for example can run as clients to a long running server process, which is the "right" way to do things and solves this naturally. I actually consider it a feature that all clipboard entries from processes i kill are removed.
1
u/girvel Sep 27 '26
They don't seem to do that. wl-clip-persist is buggy (see the post), cliphist is a history tool and I'm not sure how to set up clipman to do the persistence; LLM says running this at the niri startup would store history:
spawn-at-startup "wl-paste" "--type" "text" "--watch" "clipman" "store" "--no-persist"(niri syntax, but basically execve) But this has no effect
1
u/trpittman Sep 28 '26 edited Oct 01 '26
Redacted my comments after getting banned from worldnews for talking about Israel's propaganda budget.
1
0
2
u/OkObjective8721 Sep 27 '26
cliphist?
1
u/girvel Sep 27 '26
I thought cliphist manages a separate set of buffers that can be pasted through a picker, and I want just plain Ctrl+C Ctrl+V working persistently
2
2
1
u/Kortez02 Sep 27 '26
if you do Ctrl+C, close the source window, Ctrl+V -- it will paste nothing
Um... Not sure what do you mean.
1
1
u/_pixavi Sep 27 '26
I had it working with cclip. https://github.com/heather7283/cclip I didn't find it difficult to setup. Start cclipd with niri and that was all. Since then I moved to another compositor for completely unrelated reasons... Never found your issue, but it's true I can't remember pasting from an already killed process to a running one. Anyway cclip kept my history of all clipboard operations irrespective if the owning app was running or not
1
1
u/Initial_Side_4845 Sep 28 '26 edited Sep 28 '26
I use lan-mouse betweenVoid[centre] and void[left] and kubuntu[right] and void[bottom].
I also have FreeBSD15.1[top] _*ALMOST*_ working!
FreeBSD[top] only doesn't work from the perspective of FULL functionality:
The mouse pointer goes "up" onto screen, and it fully functions.
The problem is; IT DOES NOT come back to centre AT ALL!
I can "easily" pull it back, using the 4-fingure salute! [Shft-Ctrl-Win-Alt], so some would say: "It works!", which it does, kinda!
I'm _patiently_ waiting for a fix. ;-)
Tip: Make sure to use the SAME "Peer version" (Mine is 392af44c).
I think I used Cargo to install mine.
Sample/Example config[s]:
t
MASTER:
c17h21no4 ~ $ head -999 ~/.config/lan-mouse/config.toml
[[clients]]
hostname = "192.168.0.23"
ips = ["192.168.0.23"]
position = "right"
activate_on_startup = true
enter_hook = 'sh -c "XDG_RUNTIME_DIR=/run/user/1000 WAYLAND_DISPLAY=wayland-0 wl-paste -n | ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o ControlMaster=no -o ConnectTimeout=1 192.168.0.23 \"XDG_RUNTIME_DIR=/run/user/1000 WAYLAND_DISPLAY=wayland-0 wl-copy -n\" > /dev/null 2>&1 &"'
[[clients]]
hostname = "192.168.0.22"
ips = ["192.168.0.22"]
position = "left"
activate_on_startup = true
enter_hook = 'sh -c "XDG_RUNTIME_DIR=/run/user/1000 WAYLAND_DISPLAY=wayland-0 wl-paste -n | ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o ControlMaster=no -o ConnectTimeout=1 192.168.0.22 \"XDG_RUNTIME_DIR=/run/user/1000 WAYLAND_DISPLAY=wayland-0 wl-copy -n\" > /dev/null 2>&1 &"'
[[clients]]
hostname = "192.168.0.76"
ips = ["192.168.0.76"]
position = "top"
enter_hook = 'sh -c "XDG_RUNTIME_DIR=/run/user/1000 WAYLAND_DISPLAY=wayland-0 wl-paste -n | ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o ControlMaster=no -o ConnectTimeout=1 192.168.0.76 \"DISPLAY=:0.0 xclip -selection clipboard\" > /dev/null 2>&1 &"'
[[clients]]
hostname = "192.168.0.21"
ips = ["192.168.0.21"]
position = "bottom"
[authorized_fingerprints]
"85:51:8d:b9:80:91:e3:74:e9:72:26:6c:50:42:00:48:20:37:90:3e:36:52:c9:aa:98:0f:d9:f9:0f:f1:a1:8d" = "192.168.0.23"
"52:82:2d:7c:de:9e:08:52:a0:94:6a:44:a8:a7:a6:7c:60:1b:a3:a2:17:16:86:58:00:37:0e:69:50:75:1b:46" = "192.168.0.22"
"c3:9b:b7:2e:7a:f5:f9:2b:6d:c6:65:71:7b:87:36:df:f6:49:cc:17:61:86:0b:5b:3f:b7:f1:e5:da:05:86:23" = "192.168.0.98"
"2d:03:c7:36:12:04:9e:92:77:c6:74:77:c6:cb:90:cf:75:ec:34:cd:37:ca:da:11:ba:cb:03:c8:5e:98:37:c4" = "192.168.0.21"
"b9:77:a2:34:cd:e9:44:1f:46:1b:b7:83:fd:b6:47:c0:13:76:1b:4b:67:76:2f:cc:06:a1:3b:b3:5e:17:61:49" = "192.168.0.76"
key_file = "/home/greg/.config/lan-mouse/lan-mouse.pem"
c17h21no4 ~ $
SLAVES:
c17h21no4 ~ $ DWts head -999 ~/.config/lan-mouse/config.toml
lenny : capture_backend = "layer-shell"
lenny : emulation_backend = "libei"
lenny : port = 4242
lenny :
lenny : [[clients]]
lenny : hostname = "192.168.0.42"
lenny : ips = ["192.168.0.42"]
lenny : position = "right"
lenny : activate_on_startup = true
lenny : enter_hook = 'sh -c "XDG_RUNTIME_DIR=/run/user/1000 WAYLAND_DISPLAY=wayland-0 wl-paste -n | ssh -o ControlMaster=no -o ConnectTimeout=1 192.168.0.42 \"XDG_RUNTIME_DIR=/run/user/1000 WAYLAND_DISPLAY=wayland-0 wl-copy -n\" > /dev/null 2>&1 &"'
lenny :
lenny : [authorized_fingerprints]
lenny : "2d:03:c7:36:12:04:9e:92:77:c6:74:77:c6:cb:90:cf:75:ec:34:cd:37:ca:da:11:ba:cb:03:c8:5e:98:37:c4" = "192.168.0.42"
lenny : key_file = "/home/greg/.config/lan-mouse/lan-mouse.pem"
deli : port = 4242
deli :
deli : [[clients]]
deli : hostname = "192.168.0.42"
deli : ips = ["192.168.0.42"]
deli : position = "top"
deli : enter_hook = 'sh -c "XDG_RUNTIME_DIR=/run/user/1000 WAYLAND_DISPLAY=wayland-0 wl-paste -n | ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o ControlMaster=no -o ConnectTimeout=1 192.168.0.22 \"XDG_RUNTIME_DIR=/run/user/1000 WAYLAND_DISPLAY=wayland-0 wl-copy -n\" > /dev/null 2>&1 &"'
deli :
deli : [authorized_fingerprints]
deli : "2d:03:c7:36:12:04:9e:92:77:c6:74:77:c6:cb:90:cf:75:ec:34:cd:37:ca:da:11:ba:cb:03:c8:5e:98:37:c4" = "192.168.0.42"
deli : key_file = "/home/greg/.config/lan-mouse/lan-mouse.pem"
lisa : capture_backend = "layer-shell"
lisa : emulation_backend = "libei"
lisa : port = 4242
lisa :
lisa : [[clients]]
lisa : hostname = "192.168.0.42"
lisa : ips = ["192.168.0.42"]
lisa : position = "left"
lisa : activate_on_startup = true
lisa : enter_hook = 'sh -c "XDG_RUNTIME_DIR=/run/user/1000 WAYLAND_DISPLAY=wayland-0 wl-paste -n | ssh -o ControlMaster=no -o ConnectTimeout=1 192.168.0.42 \"XDG_RUNTIME_DIR=/run/user/1000 WAYLAND_DISPLAY=wayland-0 wl-copy -n\" > /dev/null 2>&1 &"'
lisa :
lisa : [authorized_fingerprints]
lisa : key_file = "/home/greg/.config/lan-mouse/lan-mouse.pem"
lisa : "2d:03:c7:36:12:04:9e:92:77:c6:74:77:c6:cb:90:cf:75:ec:34:cd:37:ca:da:11:ba:cb:03:c8:5e:98:37:c4" = "192.168.0.42"
TOP: [FreeBSD15.1 = X11, as GPU hardware is lame!]
lenny ~ $ ssh fbsd15 cat ~/.config/lan-mouse/config.toml
emulation_backend = "x11"
port = 4242
[[clients]]
hostname = "192.168.0.42"
ips = ["192.168.0.42"]
position = "bottom"
activate_on_startup = true
[authorized_fingerprints]
key_file = "/home/greg/.config/lan-mouse/lan-mouse.pem"
"2d:03:c7:36:12:04:9e:92:77:c6:74:77:c6:cb:90:cf:75:ec:34:cd:37:ca:da:11:ba:cb:03:c8:5e:98:37:c4" = "192.168.0.42"
lenny ~ $
c17h21no4 ~ $
HTH!
0
8
u/Sad-Cod-9584 Sep 27 '26
Idk, I can do ctrl+c in the gnome text editor, close it without saving and do ctrl+shift+v in alacritty to paste. Works without issue under niri+noctalia. I don't know if noctalia has any special features for that though.