Not detecting Wayland / Weston
I am starting weston from X11 like this:
export WAYLAND_DISPLAY=mysocket
weston --socket=$WAYLAND_DISPLAY --backend=x11-backend.so
When I now start clipboard-sync, it doesn't seem to find the wayland session, even when I ensure WAYLAND_DISPLAY is set correctly. It logs:
INFO - Using clipboards: [X11Clipboard { display: ":0" }]
wl-copy works fine: WAYLAND_DISPLAY=mysocket wl-copy "a test"
Looking at the source, it seems like clipboard-sync expects the environment variable to be wayland-X, where X is an digit:
https://github.com/dnut/clipboard-sync/blob/a79e6ad41faafbeb0db974fc08b3a8e6207ac6d5/src/sync.rs#L195
So I now am using wayland-0, but get:
WARN - wayland-0 does not support zwlr_data_control_manager_v1. If you are running gnome in wayland, that's OK because it provides an x11 clipboard, which will be used instead.
Looks like Weston does not support zwlr_data_control_manager_v1 currently.. Any workarounds?
https://wayland.app/protocols/wlr-data-control-unstable-v1#compositor-support
https://gitlab.freedesktop.org/wayland/weston/-/issues/955
I tried cage, however it fails with
00:00:00.000 [backend/x11/backend.c:607] Failed to query DRI3 DRM FD
00:00:00.000 [../cage.c:311] Unable to create the wlroots backend
(Due to https://forums.developer.nvidia.com/t/dri3open-missing-in-the-x11-driver-for-wlroots-compositors/214164/2)
I think even if zwlr_data_control_manager_v1 is not supported, it would still be nice if clipboard-sync would paste into that wayland session (but not watch for clipboard changes, since that's not possible)
I've reproduced this. Since wl-copy and wl-paste work, it's clearly doable. I'm looking into it now to figure out the best way to get this into clipboard-sync.
I think even if
zwlr_data_control_manager_v1is not supported, it would still be nice if clipboard-sync would paste into that wayland session (but not watch for clipboard changes, since that's not possible)
I got this much working. My initial quick and dirty approach is using the wl-copy command for wayland clipboards that do not support wlr. You'll need wl-copy installed to take advantage of this. It only copies in, but not out. In the future, I would like to implement the logic from wl-copy directly, so you don't need it as a dependency.
wl-paste could work to get data out, but the problem is that wl-paste needs to open a window to do its job. clipboard-sync needs to perform frequent polling of the clipboard. I tested this and the frequent opening and closing of windows causes severe usability problems for the desktop environment. So clipboard-sync doesn't use wl-paste for polling. This is why it only supports bringing data in but not out of these clipboards.