Sync nested wayland compositor clipboard / primary selection

When running a nested compositor (say - sway) inside another wayland compositor (say - kde kwin), how do synchronize bidirectionally the clipboard (and/or primary selection) between both compositors?

What works for me is uni-directional sync with wl-clipboard (2.3.0, Fedora 43 kde and sway):

wl-paste --primary --watch env WAYLAND_DISPLAY=wayland-1 wl-copy --primary

Meaning I can paste in sway everything I have selected in the kde session.

However, when I naively set up the opposite direction, as well, the copy/paste events seem to get stuck in an endless loop:

wl-paste --primary --watch env WAYLAND_DISPLAY=wayland-1 wl-copy --primary
WAYLAND_DISPLAY=wayland-1 wl-paste --primary --watch env WAYLAND_DISPLAY=wayland-0 wl-copy --primary

That means both commands are running in parallel, e.g. in different terminals. The signs of the endless loop: paste doesn't work anymore and kwin cpu usage rises to 25 % such that fans spin up.

How to sync the wayland clipboard in both directions properly?

添加评论
点赞收藏
点踩分享查看原文
评论
?
参与讨论