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/wl-paste hang when used from guake #172

Closed alexheretic closed 1 year ago

alexheretic commented 1 year ago

Steps to reproduce using guake on Arch

$ wl-copy foo

This hangs until I toggle guake, when I return I see it has run. Similarly for wl-paste.

Debug output ``` $ WAYLAND_DEBUG=1 wl-copy foo [2352809.896] -> wl_display@1.get_registry(new id wl_registry@2) [2352809.902] -> wl_display@1.sync(new id wl_callback@3) [2352809.958] wl_display@1.delete_id(3) [2352809.961] wl_registry@2.global(1, "wl_compositor", 5) [2352809.964] -> wl_registry@2.bind(1, "wl_compositor", 2, new id [unknown]@4) [2352809.966] wl_registry@2.global(2, "wl_drm", 2) [2352809.967] wl_registry@2.global(3, "wl_shm", 1) [2352809.969] -> wl_registry@2.bind(3, "wl_shm", 1, new id [unknown]@5) [2352809.970] wl_registry@2.global(4, "wl_output", 3) [2352809.971] wl_registry@2.global(5, "zxdg_output_manager_v1", 3) [2352809.973] wl_registry@2.global(6, "wl_data_device_manager", 3) [2352809.974] -> wl_registry@2.bind(6, "wl_data_device_manager", 1, new id [unknown]@6) [2352809.977] wl_registry@2.global(7, "zwp_primary_selection_device_manager_v1", 1) [2352809.978] -> wl_registry@2.bind(7, "zwp_primary_selection_device_manager_v1", 1, new id [unknown]@7) [2352809.980] wl_registry@2.global(8, "wl_subcompositor", 1) [2352809.981] wl_registry@2.global(9, "xdg_wm_base", 4) [2352809.983] -> wl_registry@2.bind(9, "xdg_wm_base", 1, new id [unknown]@8) [2352809.985] wl_registry@2.global(10, "gtk_shell1", 5) [2352809.986] wl_registry@2.global(11, "wp_viewporter", 1) [2352809.988] wl_registry@2.global(12, "zwp_pointer_gestures_v1", 3) [2352809.989] wl_registry@2.global(13, "zwp_tablet_manager_v2", 1) [2352809.991] wl_registry@2.global(14, "wl_seat", 8) [2352809.992] -> wl_registry@2.bind(14, "wl_seat", 2, new id [unknown]@9) [2352809.994] wl_registry@2.global(15, "zwp_relative_pointer_manager_v1", 1) [2352809.995] wl_registry@2.global(16, "zwp_pointer_constraints_v1", 1) [2352809.997] wl_registry@2.global(17, "zxdg_exporter_v1", 1) [2352809.998] wl_registry@2.global(18, "zxdg_importer_v1", 1) [2352810.000] wl_registry@2.global(19, "zwp_linux_dmabuf_v1", 4) [2352810.001] wl_registry@2.global(20, "wp_single_pixel_buffer_manager_v1", 1) [2352810.003] wl_registry@2.global(21, "zwp_keyboard_shortcuts_inhibit_manager_v1", 1) [2352810.004] wl_registry@2.global(22, "zwp_text_input_manager_v3", 1) [2352810.006] wl_registry@2.global(23, "wp_presentation", 1) [2352810.007] wl_registry@2.global(24, "xdg_activation_v1", 1) [2352810.009] wl_callback@3.done(7544) [2352810.010] -> wl_display@1.sync(new id wl_callback@3) [2352810.040] wl_display@1.delete_id(3) [2352810.043] wl_seat@9.capabilities(3) [2352810.044] wl_seat@9.name("seat0") [2352810.045] wl_callback@3.done(7544) [2352810.047] -> wl_data_device_manager@6.get_data_device(new id wl_data_device@3, wl_seat@9) [2352810.049] -> wl_data_device_manager@6.create_data_source(new id wl_data_source@10) [2352810.051] -> wl_data_source@10.offer("text/plain") [2352810.052] -> wl_data_source@10.offer("text/plain;charset=utf-8") [2352810.053] -> wl_data_source@10.offer("TEXT") [2352810.055] -> wl_data_source@10.offer("STRING") [2352810.056] -> wl_data_source@10.offer("UTF8_STRING") [2352810.058] -> wl_seat@9.get_keyboard(new id wl_keyboard@11) [2352810.160] wl_keyboard@11.keymap(1, fd 4, 75340) [2352810.173] -> wl_compositor@4.create_surface(new id wl_surface@12) [2352810.176] -> xdg_wm_base@8.get_xdg_surface(new id xdg_surface@13, wl_surface@12) [2352810.178] -> xdg_surface@13.get_toplevel(new id xdg_toplevel@14) [2352810.180] -> xdg_toplevel@14.set_title("wl-clipboard") [2352810.181] -> wl_surface@12.commit() [2352810.183] -> wl_display@1.sync(new id wl_callback@15) [2352810.900] wl_display@1.delete_id(15) [2352810.904] xdg_toplevel@14.configure(0, 0, array[0]) [2352810.906] xdg_surface@13.configure(760) [2352810.908] -> xdg_surface@13.ack_configure(760) [2352810.909] wl_callback@15.done(7544) [2352810.917] -> wl_shm@5.create_pool(new id wl_shm_pool@15, fd 5, 4) [2352810.919] -> wl_shm_pool@15.create_buffer(new id wl_buffer@16, 0, 1, 1, 4, 0) [2352810.921] -> wl_surface@12.attach(wl_buffer@16, 0, 0) [2352810.923] -> wl_surface@12.damage(0, 0, 1, 1) [2352810.925] -> wl_surface@12.commit() ``` This is the hang, if I double toggle guake I get some more ``` [2361972.243] xdg_toplevel@14.configure(1, 1, array[4]) [2361972.256] xdg_surface@13.configure(761) [2361972.260] -> xdg_surface@13.ack_configure(761) [2361972.264] wl_keyboard@11.modifiers(7558, 4, 0, 16, 0) [2361972.268] wl_keyboard@11.enter(7558, wl_surface@12, array[8]) [2361972.272] -> wl_data_device@3.set_selection(wl_data_source@10, 7558) [2361972.276] -> wl_display@1.sync(new id wl_callback@17) [2361972.279] wl_data_device@3.data_offer(new id wl_data_offer@4278190080) [2361972.283] wl_data_offer@4278190080.offer("text/plain") [2361972.286] wl_data_offer@4278190080.offer("text/plain;charset=utf-8") [2361972.289] wl_data_offer@4278190080.offer("STRING") [2361972.292] wl_data_offer@4278190080.offer("TEXT") [2361972.295] wl_data_offer@4278190080.offer("COMPOUND_TEXT") [2361972.297] wl_data_offer@4278190080.offer("UTF8_STRING") [2361972.299] wl_data_offer@4278190080.offer("SAVE_TARGETS") [2361972.300] wl_data_offer@4278190080.offer("MULTIPLE") [2361972.302] wl_data_offer@4278190080.offer("TARGETS") [2361972.303] wl_data_offer@4278190080.offer("TIMESTAMP") [2361972.305] wl_data_device@3.selection(wl_data_offer@4278190080) [2361972.881] wl_display@1.delete_id(17) [2361972.884] wl_data_device@3.data_offer(new id wl_data_offer@4278190081) [2361972.886] wl_data_offer@4278190081.offer("UTF8_STRING") [2361972.887] wl_data_offer@4278190081.offer("STRING") [2361972.890] wl_data_offer@4278190081.offer("TEXT") [2361972.892] wl_data_offer@4278190081.offer("text/plain;charset=utf-8") [2361972.893] wl_data_offer@4278190081.offer("text/plain") [2361972.895] wl_data_device@3.selection(wl_data_offer@4278190081) [2361972.896] wl_data_source@10.send("text/plain;charset=utf-8", fd 5) [2361972.904] wl_callback@17.done(7558) [2361972.907] -> xdg_toplevel@14.destroy() [2361972.909] -> xdg_surface@13.destroy() [2361972.911] -> wl_surface@12.destroy() [2361975.755] wl_display@1.delete_id(14) [2361975.770] wl_display@1.delete_id(13) [2361975.773] wl_display@1.delete_id(12) [2361975.775] wl_keyboard@11.leave(7559, nil) [2388417.165] wl_data_source@10.send("UTF8_STRING", fd 5) [2390527.107] wl_data_source@10.cancelled() ```

Downstream issue: https://github.com/Guake/guake/issues/2082#issuecomment-1506453524

bugaevc commented 1 year ago

This is very likely the same as https://github.com/bugaevc/wl-clipboard/issues/163, but please mention what compositor you're running this under (Mutter?).

alexheretic commented 1 year ago

This is very likely the same as #163, but please mention what compositor you're running this under (Mutter?).

Yep mutter.

bugaevc commented 1 year ago

Well, there isn't much I can do on my side here. Either Mutter needs to implement a better clipboard protocol that doesn't require me to steal focus, or Guake needs to stop preventing me from stealing focus. The former is unlikely to happen, so hope for the latter 🙂

alexheretic commented 1 year ago

Well, there isn't much I can do on my side here. Either Mutter needs to implement a better clipboard protocol that doesn't require me to steal focus, or Guake needs to stop preventing me from stealing focus. The former is unlikely to happen, so hope for the latter slightly_smiling_face

Thanks for the info! Any idea how the latter happens? How is guake preventing this?

alexheretic commented 1 year ago

It looks like the guake "Stay on top" option is preventing wl-copy focus steals. Thanks for your help.

tcstory commented 1 year ago

It looks like the guake "Stay on top" option is preventing wl-copy focus steals. Thanks for your help.

thanks for you help. I need to uncheck the "Stay on top" option to make it work.