bugaevc / wl-clipboard

Command-line copy/paste utilities for Wayland
GNU General Public License v3.0
1.62k stars 60 forks source link

wl-copy -f hangs indefinitely #132

Closed CounterPillow closed 2 years ago

CounterPillow commented 2 years ago

To reproduce, run: echo "penis" | wl-copy -f

Compositor: kwin 5.24.4

I need to use wl-copy -f because otherwise wl-copy fails when run from spectacle for some reason. The hang is not reproducible without -f.

Output with WAYLAND_DEBUG=1:

$ echo "penis" | WAYLAND_DEBUG=1 wl-copy -f
[1038468.986]  -> wl_display@1.get_registry(new id wl_registry@2)
[1038469.042]  -> wl_display@1.sync(new id wl_callback@3)
[1038474.808] wl_display@1.delete_id(3)
[1038474.829] wl_registry@2.global(1, "wl_compositor", 4)
[1038474.854]  -> wl_registry@2.bind(1, "wl_compositor", 2, new id [unknown]@4)
[1038474.884] wl_registry@2.global(2, "zwp_tablet_manager_v2", 1)
[1038474.906] wl_registry@2.global(3, "zwp_keyboard_shortcuts_inhibit_manager_v1", 1)
[1038474.925] wl_registry@2.global(5, "xdg_wm_base", 3)
[1038474.947]  -> wl_registry@2.bind(5, "xdg_wm_base", 1, new id [unknown]@5)
[1038474.979] wl_registry@2.global(6, "zwlr_layer_shell_v1", 3)
[1038475.002] wl_registry@2.global(7, "zxdg_decoration_manager_v1", 1)
[1038475.024] wl_registry@2.global(8, "wp_viewporter", 1)
[1038475.047] wl_registry@2.global(9, "wl_shm", 1)
[1038475.069]  -> wl_registry@2.bind(9, "wl_shm", 1, new id [unknown]@6)
[1038475.095] wl_registry@2.global(10, "wl_seat", 7)
[1038475.113]  -> wl_registry@2.bind(10, "wl_seat", 2, new id [unknown]@7)
[1038475.145] wl_registry@2.global(11, "zwp_pointer_gestures_v1", 3)
[1038475.166] wl_registry@2.global(12, "zwp_pointer_constraints_v1", 1)
[1038475.189] wl_registry@2.global(13, "zwp_relative_pointer_manager_v1", 1)
[1038475.209] wl_registry@2.global(14, "wl_data_device_manager", 3)
[1038475.232]  -> wl_registry@2.bind(14, "wl_data_device_manager", 1, new id [unknown]@8)
[1038475.260] wl_registry@2.global(15, "zwlr_data_control_manager_v1", 2)
[1038475.283]  -> wl_registry@2.bind(15, "zwlr_data_control_manager_v1", 2, new id [unknown]@9)
[1038475.314] wl_registry@2.global(16, "zwp_primary_selection_device_manager_v1", 1)
[1038475.335]  -> wl_registry@2.bind(16, "zwp_primary_selection_device_manager_v1", 1, new id [unknown]@10)
[1038475.367] wl_registry@2.global(17, "org_kde_kwin_idle", 1)
[1038475.389] wl_registry@2.global(18, "zwp_idle_inhibit_manager_v1", 1)
[1038475.410] wl_registry@2.global(19, "org_kde_plasma_shell", 6)
[1038475.432] wl_registry@2.global(20, "org_kde_kwin_appmenu_manager", 1)
[1038475.454] wl_registry@2.global(21, "org_kde_kwin_server_decoration_palette_manager", 1)
[1038475.476] wl_registry@2.global(23, "org_kde_plasma_virtual_desktop_management", 2)
[1038475.497] wl_registry@2.global(25, "org_kde_kwin_shadow_manager", 2)
[1038475.519] wl_registry@2.global(26, "org_kde_kwin_dpms_manager", 1)
[1038475.540] wl_registry@2.global(27, "org_kde_kwin_server_decoration_manager", 1)
[1038475.560] wl_registry@2.global(28, "kde_output_management_v2", 2)
[1038475.581] wl_registry@2.global(29, "kde_primary_output_v1", 1)
[1038475.603] wl_registry@2.global(30, "zxdg_output_manager_v1", 3)
[1038475.625] wl_registry@2.global(31, "wl_subcompositor", 1)
[1038475.646] wl_registry@2.global(32, "zxdg_exporter_v2", 1)
[1038475.669] wl_registry@2.global(33, "zxdg_importer_v2", 1)
[1038475.691] wl_registry@2.global(36, "xdg_activation_v1", 1)
[1038475.712] wl_registry@2.global(37, "wp_drm_lease_device_v1", 1)
[1038475.732] wl_registry@2.global(40, "wl_drm", 2)
[1038475.753] wl_registry@2.global(41, "zwp_linux_dmabuf_v1", 4)
[1038475.773] wl_registry@2.global(42, "kde_output_device_v2", 2)
[1038475.793] wl_registry@2.global(43, "wl_output", 3)
[1038475.815] wl_registry@2.global(44, "zwp_text_input_manager_v2", 1)
[1038475.836] wl_registry@2.global(45, "zwp_text_input_manager_v3", 1)
[1038475.858] wl_registry@2.global(46, "org_kde_kwin_contrast_manager", 2)
[1038475.880] wl_registry@2.global(47, "org_kde_kwin_blur_manager", 1)
[1038475.902] wl_registry@2.global(48, "org_kde_kwin_slide_manager", 1)
[1038475.923] wl_callback@3.done(35772)
[1038475.937]  -> wl_display@1.sync(new id wl_callback@3)
[1038476.103] wl_display@1.delete_id(3)
[1038476.123] wl_seat@7.capabilities(7)
[1038476.132] wl_seat@7.name("")
[1038476.145] wl_callback@3.done(35772)
[1038476.165]  -> zwlr_data_control_manager_v1@9.get_data_device(new id zwlr_data_control_device_v1@3, wl_seat@7)
[1038504.069]  -> zwlr_data_control_manager_v1@9.create_data_source(new id zwlr_data_control_source_v1@11)
[1038504.104]  -> zwlr_data_control_source_v1@11.offer("text/plain")
[1038504.116]  -> zwlr_data_control_source_v1@11.offer("text/plain")
[1038504.127]  -> zwlr_data_control_source_v1@11.offer("text/plain;charset=utf-8")
[1038504.137]  -> zwlr_data_control_source_v1@11.offer("TEXT")
[1038504.145]  -> zwlr_data_control_source_v1@11.offer("STRING")
[1038504.155]  -> zwlr_data_control_source_v1@11.offer("UTF8_STRING")
[1038504.166]  -> zwlr_data_control_device_v1@3.set_selection(zwlr_data_control_source_v1@11)
[1038504.179]  -> wl_display@1.sync(new id wl_callback@12)
[1038504.461] wl_display@1.delete_id(12)
[1038504.480] zwlr_data_control_device_v1@3.data_offer(new id zwlr_data_control_offer_v1@4278190080)
[1038504.499] zwlr_data_control_offer_v1@4278190080.offer("text/plain")
[1038504.510] zwlr_data_control_offer_v1@4278190080.offer("text/html")
[1038504.517] zwlr_data_control_offer_v1@4278190080.offer("text/plain;charset=utf-8")
[1038504.525] zwlr_data_control_device_v1@3.selection(zwlr_data_control_offer_v1@4278190080)
[1038504.531] zwlr_data_control_device_v1@3.data_offer(new id zwlr_data_control_offer_v1@4278190081)
[1038504.540] zwlr_data_control_offer_v1@4278190081.offer("text/plain")
[1038504.548] zwlr_data_control_offer_v1@4278190081.offer("text/html")
[1038504.555] zwlr_data_control_offer_v1@4278190081.offer("text/plain;charset=utf-8")
[1038504.563] zwlr_data_control_device_v1@3.primary_selection(zwlr_data_control_offer_v1@4278190081)
[1038504.570] zwlr_data_control_device_v1@3.data_offer(new id zwlr_data_control_offer_v1@4278190082)
[1038504.581] zwlr_data_control_offer_v1@4278190082.offer("text/plain")
[1038504.588] zwlr_data_control_offer_v1@4278190082.offer("text/plain")
[1038504.595] zwlr_data_control_offer_v1@4278190082.offer("text/plain;charset=utf-8")
[1038504.603] zwlr_data_control_offer_v1@4278190082.offer("TEXT")
[1038504.610] zwlr_data_control_offer_v1@4278190082.offer("STRING")
[1038504.616] zwlr_data_control_offer_v1@4278190082.offer("UTF8_STRING")
[1038504.623] zwlr_data_control_device_v1@3.selection(zwlr_data_control_offer_v1@4278190082)
[1038504.630] wl_callback@12.done(35772)
[1044071.843] zwlr_data_control_device_v1@3.data_offer(new id zwlr_data_control_offer_v1@4278190083)
[1044071.862] zwlr_data_control_offer_v1@4278190083.offer("text/plain")
[1044071.876] zwlr_data_control_offer_v1@4278190083.offer("text/html")
[1044071.887] zwlr_data_control_offer_v1@4278190083.offer("text/plain;charset=utf-8")
[1044071.892] zwlr_data_control_device_v1@3.primary_selection(zwlr_data_control_offer_v1@4278190083)
YaLTeR commented 2 years ago

This is the normal behavior. There's no "global clipboard" on Wayland or X11; applications provide clipboard contents on demand. This means that wl-copy must run in the background (or, with -f in your case, in foreground) and serve the clipboard contents until something else replaces them.