wl-clipboard-rs icon indicating copy to clipboard operation
wl-clipboard-rs copied to clipboard

Implement hack/workaround for missing wlr-data-control

Open jarod opened this issue 1 year ago • 4 comments

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 23.10
Release:        23.10
Codename:       mantic

$ echo "$XDG_SESSION_TYPE"
wayland

$ wl-copy --version
wl-copy 0.8.0

$ echo "test" | WAYLAND_DEBUG=1 ./wl-copy
[1699667777.010009] -> [email protected]_registry (wl_registry@2)
[1699667777.010185] -> [email protected] (wl_callback@3)
[1699667777.010765] <- [email protected], (1, Some("wl_compositor"), 5)
[1699667777.011061] <- [email protected], (2, Some("wl_drm"), 2)
[1699667777.011369] <- [email protected], (3, Some("wl_shm"), 1)
[1699667777.011578] <- [email protected], (4, Some("wl_output"), 4)
[1699667777.011810] <- [email protected], (5, Some("zxdg_output_manager_v1"), 3)
[1699667777.012101] <- [email protected], (6, Some("wl_data_device_manager"), 3)
[1699667777.012395] <- [email protected], (7, Some("zwp_primary_selection_device_manager_v1"), 1)
[1699667777.012876] <- [email protected], (8, Some("wl_subcompositor"), 1)
[1699667777.013146] <- [email protected], (9, Some("xdg_wm_base"), 6)
[1699667777.013386] <- [email protected], (10, Some("gtk_shell1"), 5)
[1699667777.013611] <- [email protected], (11, Some("wp_viewporter"), 1)
[1699667777.013843] <- [email protected], (12, Some("wp_fractional_scale_manager_v1"), 1)
[1699667777.014208] <- [email protected], (13, Some("zwp_pointer_gestures_v1"), 3)
[1699667777.014514] <- [email protected], (14, Some("zwp_tablet_manager_v2"), 1)
[1699667777.014815] <- [email protected], (15, Some("wl_seat"), 8)
[1699667777.015022] <- [email protected], (16, Some("zwp_relative_pointer_manager_v1"), 1)
[1699667777.015646] <- [email protected], (17, Some("zwp_pointer_constraints_v1"), 1)
[1699667777.016015] <- [email protected], (18, Some("zxdg_exporter_v2"), 1)
[1699667777.016283] <- [email protected], (19, Some("zxdg_importer_v2"), 1)
[1699667777.016544] <- [email protected], (20, Some("zxdg_exporter_v1"), 1)
[1699667777.016811] <- [email protected], (21, Some("zxdg_importer_v1"), 1)
[1699667777.017076] <- [email protected], (22, Some("zwp_linux_dmabuf_v1"), 4)
[1699667777.017357] <- [email protected], (23, Some("wp_single_pixel_buffer_manager_v1"), 1)
[1699667777.017741] <- [email protected], (24, Some("zwp_keyboard_shortcuts_inhibit_manager_v1"), 1)
[1699667777.018166] <- [email protected], (25, Some("zwp_text_input_manager_v3"), 1)
[1699667777.018511] <- [email protected], (26, Some("wp_presentation"), 1)
[1699667777.018768] <- [email protected], (27, Some("xdg_activation_v1"), 1)
[1699667777.019035] <- [email protected], (28, Some("zwp_idle_inhibit_manager_v1"), 1)
[1699667777.019426] <- [email protected], (2857)
[1699667777.019544] <- [email protected]_id, (3)
Error: A required Wayland protocol (zwlr_data_control_manager_v1 version 1) is not supported by the compositor

while wl-clipboard 2.2.0 works fine on the same system.

jarod avatar Nov 11 '23 01:11 jarod

I'm guessing this is GNOME? It is expected that wl-clipboard-rs doesn't work there since mutter doesn't implement the wlr-data-control protocol. The way wl-clipboard works is with a hack where it spawns a 1x1 window for a splitsecond, then relies on the compositor to give it focus automatically, and uses the standard Wayland clipboard protocol. This hack is not implemented in wl-clipboard-rs.

YaLTeR avatar Nov 11 '23 03:11 YaLTeR

I'm guessing this is GNOME? It is expected that wl-clipboard-rs doesn't work there since mutter doesn't implement the wlr-data-control protocol. The way wl-clipboard works is with a hack where it spawns a 1x1 window for a splitsecond, then relies on the compositor to give it focus automatically, and uses the standard Wayland clipboard protocol. This hack is not implemented in wl-clipboard-rs.

Thanks for explaining the cause. My machine is running on Ubuntu with GNOME. Is there a plan to implement the hack for wl-clipboard-rs? it will making wl-clipboard-rs a more useful tool.

jarod avatar Nov 11 '23 05:11 jarod

No concrete plans.

YaLTeR avatar Nov 11 '23 06:11 YaLTeR

Same issue with Crostini (Linux VMs in ChromeOS), and yes, wl-clipboard works fine there.

thiagokokada avatar Jan 11 '24 13:01 thiagokokada