Closed Zesko closed 9 months ago
Hm, how's this a wl-clipboard issue? I'm pretty sure wl-paste doesn't hang when the clipboard is empty.
I see micro
probably has this issue. Thanks!
I'm pretty sure wl-paste doesn't hang when the clipboard is empty.
But I can reproduce this issue: wl-paste
hangs in Konsole on KDE when the clipboard is empty.
Steps to reproduce the behavior:
xclip
wl-copy --clear
(<-- This causes the issue of wl-paste later)wl-paste
, but it hangs and waiting for wl-copy any text
I checked wl-clipboard-rs
that has no issue. wl-past
does not hang when the clipboard is empty.
Hi! 🙂
Please try to reproduce this with WAYLAND_DEBUG=1
and show me the logs. As in, run this:
$ WAYLAND_DEBUG=1 wl-paste
with wl-paste
from wl-clipboard proper and from wl-clipboard-rs. Maybe that would shed some light at what the difference in behavior is.
Use wl-paste
that hangs when Klipper (the clipboard) is empty on KDE Wayland.
$ WAYLAND_DEBUG=1 wl-paste
[3176844.742] -> wl_display@1.get_registry(new id wl_registry@2)
[3176844.750] -> wl_display@1.sync(new id wl_callback@3)
[3176847.504] wl_display@1.delete_id(3)
[3176847.512] wl_registry@2.global(1, "wl_compositor", 5)
[3176847.514] -> wl_registry@2.bind(1, "wl_compositor", 2, new id [unknown]@4)
[3176847.519] wl_registry@2.global(3, "zwp_tablet_manager_v2", 1)
[3176847.521] wl_registry@2.global(4, "zwp_keyboard_shortcuts_inhibit_manager_v1", 1)
[3176847.522] wl_registry@2.global(6, "xdg_wm_base", 4)
[3176847.524] -> wl_registry@2.bind(6, "xdg_wm_base", 1, new id [unknown]@5)
[3176847.526] wl_registry@2.global(7, "zwlr_layer_shell_v1", 3)
[3176847.529] wl_registry@2.global(8, "zxdg_decoration_manager_v1", 1)
[3176847.532] wl_registry@2.global(9, "wp_viewporter", 1)
[3176847.535] wl_registry@2.global(10, "wp_fractional_scale_manager_v1", 1)
[3176847.537] wl_registry@2.global(11, "wl_shm", 1)
[3176847.540] -> wl_registry@2.bind(11, "wl_shm", 1, new id [unknown]@6)
[3176847.543] wl_registry@2.global(12, "wl_seat", 8)
[3176847.550] -> wl_registry@2.bind(12, "wl_seat", 2, new id [unknown]@7)
[3176847.553] wl_registry@2.global(13, "zwp_pointer_gestures_v1", 3)
[3176847.555] wl_registry@2.global(14, "zwp_pointer_constraints_v1", 1)
[3176847.556] wl_registry@2.global(15, "zwp_relative_pointer_manager_v1", 1)
[3176847.558] wl_registry@2.global(16, "wl_data_device_manager", 3)
[3176847.562] -> wl_registry@2.bind(16, "wl_data_device_manager", 1, new id [unknown]@8)
[3176847.566] wl_registry@2.global(17, "zwlr_data_control_manager_v1", 2)
[3176847.568] -> wl_registry@2.bind(17, "zwlr_data_control_manager_v1", 2, new id [unknown]@9)
[3176847.570] wl_registry@2.global(18, "zwp_primary_selection_device_manager_v1", 1)
[3176847.573] -> wl_registry@2.bind(18, "zwp_primary_selection_device_manager_v1", 1, new id [unknown]@10)
[3176847.575] wl_registry@2.global(19, "org_kde_kwin_idle", 1)
[3176847.577] wl_registry@2.global(20, "zwp_idle_inhibit_manager_v1", 1)
[3176847.579] wl_registry@2.global(21, "ext_idle_notifier_v1", 1)
[3176847.582] wl_registry@2.global(22, "org_kde_plasma_shell", 8)
[3176847.583] wl_registry@2.global(23, "org_kde_kwin_appmenu_manager", 1)
[3176847.586] wl_registry@2.global(24, "org_kde_kwin_server_decoration_palette_manager", 1)
[3176847.587] wl_registry@2.global(26, "org_kde_plasma_virtual_desktop_management", 2)
[3176847.590] wl_registry@2.global(28, "org_kde_kwin_shadow_manager", 2)
[3176847.592] wl_registry@2.global(29, "org_kde_kwin_dpms_manager", 1)
[3176847.593] wl_registry@2.global(30, "org_kde_kwin_server_decoration_manager", 1)
[3176847.594] wl_registry@2.global(31, "kde_output_management_v2", 3)
[3176847.597] wl_registry@2.global(32, "zxdg_output_manager_v1", 3)
[3176847.599] wl_registry@2.global(33, "wl_subcompositor", 1)
[3176847.600] wl_registry@2.global(34, "zxdg_exporter_v2", 1)
[3176847.603] wl_registry@2.global(35, "zxdg_importer_v2", 1)
[3176847.604] wl_registry@2.global(38, "xdg_activation_v1", 1)
[3176847.608] wl_registry@2.global(40, "wp_content_type_manager_v1", 1)
[3176847.609] wl_registry@2.global(41, "wp_tearing_control_manager_v1", 1)
[3176847.612] wl_registry@2.global(43, "zwp_linux_dmabuf_v1", 4)
[3176847.614] wl_registry@2.global(45, "kde_output_device_v2", 2)
[3176847.616] wl_registry@2.global(46, "wl_output", 4)
[3176847.618] wl_registry@2.global(47, "wp_drm_lease_device_v1", 1)
[3176847.621] wl_registry@2.global(48, "kde_output_order_v1", 1)
[3176847.622] wl_registry@2.global(49, "zwp_text_input_manager_v1", 1)
[3176847.625] wl_registry@2.global(50, "zwp_text_input_manager_v2", 1)
[3176847.626] wl_registry@2.global(51, "zwp_text_input_manager_v3", 1)
[3176847.629] wl_registry@2.global(53, "org_kde_kwin_blur_manager", 1)
[3176847.630] wl_callback@3.done(709)
[3176847.634] -> wl_display@1.sync(new id wl_callback@3)
[3176847.689] wl_display@1.delete_id(3)
[3176847.693] wl_seat@7.capabilities(3)
[3176847.695] wl_seat@7.name("")
[3176847.696] wl_callback@3.done(709)
[3176847.700] -> zwlr_data_control_manager_v1@9.get_data_device(new id zwlr_data_control_device_v1@3, wl_seat@7)
This is wl-clipboard
not wl-clipboard-rs
So KWin is not sending out a selection when we create a data device?
Please show me how the same looks with wl-clipboard-rs, too. Surely it also uses wlr-data-control in a very similar way.
So KWin is not sending out a selection when we create a data device?
I have no idea, but the selection has nothing to do with this issue, I guess.
Please show me how the same looks with wl-clipboard-rs, too. Surely it also uses wlr-data-control in a very similar way.
Yes, sure. wl-clipboard-rs version 0.7.0.
$ WAYLAND_DEBUG=1 wl-paste
[1677923673.255208] -> wl_display@1.get_registry(2)
[1677923673.255221] -> wl_display@1.sync(3)
[1677923673.257564] <- wl_display@1.delete_id(3)
[1677923673.257597] <- wl_registry@2.global(1, "wl_compositor", 5)
[1677923673.257632] <- wl_registry@2.global(3, "zwp_tablet_manager_v2", 1)
[1677923673.257667] <- wl_registry@2.global(4, "zwp_keyboard_shortcuts_inhibit_manager_v1", 1)
[1677923673.257716] <- wl_registry@2.global(6, "xdg_wm_base", 4)
[1677923673.257747] <- wl_registry@2.global(7, "zwlr_layer_shell_v1", 3)
[1677923673.257795] <- wl_registry@2.global(8, "zxdg_decoration_manager_v1", 1)
[1677923673.257830] <- wl_registry@2.global(9, "wp_viewporter", 1)
[1677923673.257856] <- wl_registry@2.global(10, "wp_fractional_scale_manager_v1", 1)
[1677923673.257900] <- wl_registry@2.global(11, "wl_shm", 1)
[1677923673.257919] <- wl_registry@2.global(12, "wl_seat", 8)
[1677923673.257945] -> wl_registry@2.bind(12, "wl_seat", 8, 4)
[1677923673.257966] <- wl_registry@2.global(13, "zwp_pointer_gestures_v1", 3)
[1677923673.257994] <- wl_registry@2.global(14, "zwp_pointer_constraints_v1", 1)
[1677923673.258024] <- wl_registry@2.global(15, "zwp_relative_pointer_manager_v1", 1)
[1677923673.258059] <- wl_registry@2.global(16, "wl_data_device_manager", 3)
[1677923673.258088] <- wl_registry@2.global(17, "zwlr_data_control_manager_v1", 2)
[1677923673.258122] <- wl_registry@2.global(18, "zwp_primary_selection_device_manager_v1", 1)
[1677923673.258173] <- wl_registry@2.global(19, "org_kde_kwin_idle", 1)
[1677923673.258199] <- wl_registry@2.global(20, "zwp_idle_inhibit_manager_v1", 1)
[1677923673.258238] <- wl_registry@2.global(21, "ext_idle_notifier_v1", 1)
[1677923673.258265] <- wl_registry@2.global(22, "org_kde_plasma_shell", 8)
[1677923673.258300] <- wl_registry@2.global(23, "org_kde_kwin_appmenu_manager", 1)
[1677923673.258336] <- wl_registry@2.global(24, "org_kde_kwin_server_decoration_palette_manager", 1)
[1677923673.258379] <- wl_registry@2.global(26, "org_kde_plasma_virtual_desktop_management", 2)
[1677923673.258409] <- wl_registry@2.global(28, "org_kde_kwin_shadow_manager", 2)
[1677923673.258436] <- wl_registry@2.global(29, "org_kde_kwin_dpms_manager", 1)
[1677923673.258463] <- wl_registry@2.global(30, "org_kde_kwin_server_decoration_manager", 1)
[1677923673.258504] <- wl_registry@2.global(31, "kde_output_management_v2", 3)
[1677923673.258544] <- wl_registry@2.global(32, "zxdg_output_manager_v1", 3)
[1677923673.258578] <- wl_registry@2.global(33, "wl_subcompositor", 1)
[1677923673.258606] <- wl_registry@2.global(34, "zxdg_exporter_v2", 1)
[1677923673.258629] <- wl_registry@2.global(35, "zxdg_importer_v2", 1)
[1677923673.258642] <- wl_registry@2.global(38, "xdg_activation_v1", 1)
[1677923673.258663] <- wl_registry@2.global(40, "wp_content_type_manager_v1", 1)
[1677923673.258695] <- wl_registry@2.global(41, "wp_tearing_control_manager_v1", 1)
[1677923673.258727] <- wl_registry@2.global(43, "zwp_linux_dmabuf_v1", 4)
[1677923673.258750] <- wl_registry@2.global(45, "kde_output_device_v2", 2)
[1677923673.258776] <- wl_registry@2.global(46, "wl_output", 4)
[1677923673.258795] <- wl_registry@2.global(47, "wp_drm_lease_device_v1", 1)
[1677923673.258824] <- wl_registry@2.global(48, "kde_output_order_v1", 1)
[1677923673.258852] <- wl_registry@2.global(49, "zwp_text_input_manager_v1", 1)
[1677923673.258875] <- wl_registry@2.global(50, "zwp_text_input_manager_v2", 1)
[1677923673.258895] <- wl_registry@2.global(51, "zwp_text_input_manager_v3", 1)
[1677923673.258917] <- wl_registry@2.global(53, "org_kde_kwin_blur_manager", 1)
[1677923673.258941] <- wl_callback@3.done(360)
[1677923673.258955] -> wl_registry@2.bind(17, "zwlr_data_control_manager_v1", 1, 3)
[1677923673.258989] -> zwlr_data_control_manager_v1@3.get_data_device(5, 4)
[1677923673.259001] -> wl_display@1.sync(6)
[1677923673.259068] <- wl_display@1.delete_id(6)
[1677923673.259080] <- wl_seat@4.capabilities(3)
[1677923673.259095] <- wl_seat@4.name("")
[1677923673.259106] <- wl_callback@6.done(360)
Error: The clipboard of the requested seat is empty
$
wl-paste does not hang and is closed when the clipboard is empty. this is the expected behavior
Hmm, so wl-clipboard-rs is doing a sync, and if no selection event is received, it immediately says that the clipboard is empty. Which is probably fine as a workaround, but the protocol is rather clear that the compositor is supposed to send a selection(nil)
event immediately:
Could you please report this to KWin? Feel free to link back to this comment as an explanation of what KWin does wrong.
I see that wl-copy --clear
does not work on KDE Wayland.
$ wl-copy test
$ wl-paste
test
$ wl-copy --clear
$ wl-paste
test
Gnome Wayland has no issue with that.
Did you reproduce this issue on KDE Wayland?
I am using: kwin_wayland 5.27.2 KDE Plasma 5.27.2 KDE Framework 5.103.0 Qt 5.15.8 Wayland
Could you please report this to KWin? Feel free to link back to this comment as an explanation of what KWin does wrong.
That... seems unlikely to be related.
Also, I'm not claiming that KWin and wl-clipboard don't work together — they do, and I do test wl-clipboard under KDE all the time. But apparently things became more broken while I was away.
What I am saying though, is that they're supposed to send a selection()
event immediately after a client creates a data device, which, according to your logs, they don't. If there's nothing copied, they should still send a selection(nil)
. This is the same issue as https://github.com/bugaevc/wl-clipboard/issues/158.
I'll look into the --clear
issue, but it's likely another instance of Klipper trying to preserve clipboard contents when it should not. It's likely not their fault either — unfortunately the data-control protocol does not make it clear why the clipboard contents has disappeared (has the owning client died? was there an explicit set_selection(nil)
?).
I can reproduce both of there. The --clear
issue is indeed KDE itself (Klipper?) taking over the selection after wl-copy --clear
clears it successfully (look for application/x-kde-onlyReplaceEmpty
). They should not, but they can't because the protocol doesn't differentiate between the two cases.
And they don't send selection(nil)
upon creating the data device indeed, so that's definitely something they should fix.
Also, wl-copy
dies from a SIGPIPE
once the destination is no longer interested in our clipboard contents (perhaps they only want the first few bytes to sniff the type better?), we should definitely fix that.
The SIGPIPE
"crash" should have been taken care of by https://github.com/bugaevc/wl-clipboard/commit/3b8c9a091a43840e6aa1a844c6859c823e137e26
I also encounter this problem (when password manager KeePassXC clears the clipboard some time after copying a password from it). This causes a program that tries to grab the contents via wl-paste (tmux) wait for content aka. hang.
$ WAYLAND_DEBUG=1 wl-paste
[2092073.449] -> wl_display@1.get_registry(new id wl_registry@2)
[2092073.463] -> wl_display@1.sync(new id wl_callback@3)
[2092078.736] wl_display@1.delete_id(3)
[2092078.751] wl_registry@2.global(1, "wl_compositor", 5)
[2092078.757] -> wl_registry@2.bind(1, "wl_compositor", 2, new id [unknown]@4)
[2092078.765] wl_registry@2.global(2, "zwp_tablet_manager_v2", 1)
[2092078.768] wl_registry@2.global(3, "zwp_keyboard_shortcuts_inhibit_manager_v1", 1)
[2092078.772] wl_registry@2.global(5, "xdg_wm_base", 4)
[2092078.776] -> wl_registry@2.bind(5, "xdg_wm_base", 1, new id [unknown]@5)
[2092078.779] wl_registry@2.global(6, "zwlr_layer_shell_v1", 3)
[2092078.782] wl_registry@2.global(7, "zxdg_decoration_manager_v1", 1)
[2092078.786] wl_registry@2.global(8, "wp_viewporter", 1)
[2092078.791] wl_registry@2.global(9, "wl_shm", 1)
[2092078.797] -> wl_registry@2.bind(9, "wl_shm", 1, new id [unknown]@6)
[2092078.801] wl_registry@2.global(10, "wl_seat", 7)
[2092078.806] -> wl_registry@2.bind(10, "wl_seat", 2, new id [unknown]@7)
[2092078.811] wl_registry@2.global(11, "zwp_pointer_gestures_v1", 3)
[2092078.815] wl_registry@2.global(12, "zwp_pointer_constraints_v1", 1)
[2092078.819] wl_registry@2.global(13, "zwp_relative_pointer_manager_v1", 1)
[2092078.823] wl_registry@2.global(14, "wl_data_device_manager", 3)
[2092078.828] -> wl_registry@2.bind(14, "wl_data_device_manager", 1, new id [unknown]@8)
[2092078.833] wl_registry@2.global(15, "zwlr_data_control_manager_v1", 2)
[2092078.838] -> wl_registry@2.bind(15, "zwlr_data_control_manager_v1", 2, new id [unknown]@9)
[2092078.843] wl_registry@2.global(16, "zwp_primary_selection_device_manager_v1", 1)
[2092078.847] -> wl_registry@2.bind(16, "zwp_primary_selection_device_manager_v1", 1, new id [unknown]@10)
[2092078.852] wl_registry@2.global(17, "org_kde_kwin_idle", 1)
[2092078.856] wl_registry@2.global(18, "zwp_idle_inhibit_manager_v1", 1)
[2092078.860] wl_registry@2.global(19, "org_kde_plasma_shell", 8)
[2092078.865] wl_registry@2.global(20, "org_kde_kwin_appmenu_manager", 1)
[2092078.869] wl_registry@2.global(21, "org_kde_kwin_server_decoration_palette_manager", 1)
[2092078.873] wl_registry@2.global(23, "org_kde_plasma_virtual_desktop_management", 2)
[2092078.877] wl_registry@2.global(25, "org_kde_kwin_shadow_manager", 2)
[2092078.881] wl_registry@2.global(26, "org_kde_kwin_dpms_manager", 1)
[2092078.885] wl_registry@2.global(27, "org_kde_kwin_server_decoration_manager", 1)
[2092078.889] wl_registry@2.global(28, "kde_output_management_v2", 2)
[2092078.893] wl_registry@2.global(29, "kde_primary_output_v1", 2)
[2092078.898] wl_registry@2.global(30, "zxdg_output_manager_v1", 3)
[2092078.902] wl_registry@2.global(31, "wl_subcompositor", 1)
[2092078.906] wl_registry@2.global(32, "zxdg_exporter_v2", 1)
[2092078.910] wl_registry@2.global(33, "zxdg_importer_v2", 1)
[2092078.914] wl_registry@2.global(35, "xdg_activation_v1", 1)
[2092078.918] wl_registry@2.global(37, "wp_drm_lease_device_v1", 1)
[2092078.922] wl_registry@2.global(39, "wl_drm", 2)
[2092078.926] wl_registry@2.global(40, "zwp_linux_dmabuf_v1", 4)
[2092078.930] wl_registry@2.global(42, "kde_output_device_v2", 2)
[2092078.934] wl_registry@2.global(44, "wl_output", 4)
[2092078.938] wl_registry@2.global(46, "zwp_text_input_manager_v2", 1)
[2092078.943] wl_registry@2.global(47, "zwp_text_input_manager_v3", 1)
[2092078.947] wl_registry@2.global(49, "org_kde_kwin_contrast_manager", 2)
[2092078.952] wl_registry@2.global(50, "org_kde_kwin_blur_manager", 1)
[2092078.957] wl_registry@2.global(51, "org_kde_kwin_slide_manager", 1)
[2092078.961] wl_registry@2.global(62, "kde_output_device_v2", 2)
[2092078.965] wl_registry@2.global(63, "wl_output", 4)
[2092078.969] wl_callback@3.done(149521)
[2092078.975] -> wl_display@1.sync(new id wl_callback@3)
[2092079.059] wl_display@1.delete_id(3)
[2092079.065] wl_seat@7.capabilities(7)
[2092079.069] wl_seat@7.name("")
[2092079.074] wl_callback@3.done(149521)
[2092079.080] -> zwlr_data_control_manager_v1@9.get_data_device(new id zwlr_data_control_device_v1@3, wl_seat@7)
[2092079.125] zwlr_data_control_device_v1@3.data_offer(new id zwlr_data_control_offer_v1@4278190080)
[2092079.130] zwlr_data_control_offer_v1@4278190080.offer("text/plain")
[2092079.136] zwlr_data_control_offer_v1@4278190080.offer("text/plain;charset=utf-8")
[2092079.139] zwlr_data_control_offer_v1@4278190080.offer("STRING")
[2092079.142] zwlr_data_control_offer_v1@4278190080.offer("text/plain")
[2092079.145] zwlr_data_control_offer_v1@4278190080.offer("x-kde-passwordManagerHint")
[2092079.148] zwlr_data_control_offer_v1@4278190080.offer("TARGETS")
[2092079.151] zwlr_data_control_offer_v1@4278190080.offer("MULTIPLE")
[2092079.154] zwlr_data_control_offer_v1@4278190080.offer("TIMESTAMP")
[2092079.157] zwlr_data_control_offer_v1@4278190080.offer("SAVE_TARGETS")
[2092079.160] zwlr_data_control_device_v1@3.selection(zwlr_data_control_offer_v1@4278190080)
[2092079.175] -> zwlr_data_control_offer_v1@4278190080.receive("text/plain;charset=utf-8", fd 6)
[2092079.180] -> wl_display@1.sync(new id wl_callback@11)
[2092079.185] zwlr_data_control_device_v1@3.data_offer(new id zwlr_data_control_offer_v1@4278190081)
[2092079.189] zwlr_data_control_offer_v1@4278190081.offer("text/plain")
[2092079.192] zwlr_data_control_offer_v1@4278190081.offer("text/plain;charset=utf-8")
[2092079.196] zwlr_data_control_device_v1@3.primary_selection(zwlr_data_control_offer_v1@4278190081)
[2092079.200] -> zwlr_data_control_offer_v1@4278190081.destroy()
[2092079.230] wl_display@1.delete_id(11)
[2092079.235] wl_callback@11.done(149521)
... and just hangs there. wl-clipboard 2.1.0
This also looks like a bug in whatever software actually owns the clipboard contents at the moment. KWin is correctly passing us the offer (zwlr_data_control_offer_v1@4278190080
), and wl-paste
is correctly calling receive("text/plain;charset=utf-8")
on it (and "text/plain;charset=utf-8"
was indeed among the offered types). Then it waits to receive the data, but never does.
You're going to have to debug who owns the clipboard contents at the moment, I'm afraid.
I've just realized, I am running KeepassXC in QT xcb mode (due to a bug), so in Xwayaland, if that is relevant.
I'm on kde using wayland and not using the klipper/clipboard manager. Here wl-paste only hangs if the Xwayland clipboards are empty.
wl-paste returns Nothing is copied
if I clear the wayland clipboard by copying text (in a native wayland program, e.g. kwrite) and then close the program (confirmed by clipboard status in qdbus org.kde.KWin /KWin org.kde.KWin.showDebugConsole
).
but wl-paste hangs if I copy text from a Xwayland program, then clear the X clipboards with xsel -bc; xsel -pc; xsel -sc
Trying again with version 1:2.2.1-1 on arch linux & kde it seems fixed
Description of the problem or steps to reproduce
micro
andwl-clipboard
insteadxclip
.micro
in Konsole (KDE default terminal)Result: Micro can not be opened in Konsole when using
wl-clipboard
becausewl-paste
is empty or nowl-paste
. Micro waits until copy any text from other application, then it will be opened.Specifications
OS: Manjaro KDE Wayland (Latest version, testing branch) Terminal:
konsole
(KDE default terminal)