SUMMARY kwin does not clear the clipboard when requested through wl_data_device::set_selection(null, serial) STEPS TO REPRODUCE Bash instructions for quick reproduction (< 30 seconds): --- mkdir clip_repro cd clip_repro wget https://ziglang.org/download/0.14.0/zig-linux-x86_64-0.14.0.tar.xz tar xf zig-linux-x86_64-0.14.0.tar.xz mv zig-linux-x86_64-0.14.0 zig-0.14 git clone https://codeberg.org/ssmid/zeppelin.git cd zeppelin git checkout 475a48a9c7 ../zig-0.14/zig build run --- 1. Download zig 2. Run zeppelin: https://codeberg.org/ssmid/zeppelin/src/commit/f2005aac414bd322f89c2faf37c9fea6133a62c9 3. Type some text 4. Press Ctrl+C 5. Paste into some text editor like Kate 6. Focus zeppelin 7. Press Ctrl+Z (US layout) to clear the clipboard 8. Paste into Kate 9. (Search zeppelin logs for set_selection) OBSERVED RESULT The text still is pasted into Kate even though set_selection has been called with null. Zeppelin logs say: --> wl_data_device:10.set_selection(source: 0, serial: 2043102) The protocol says: "To unset the selection, set the source to NULL." https://wayland.app/protocols/wayland#wl_data_device:request:set_selection EXPECTED RESULT No text is pasted into Kate. SOFTWARE/OS VERSIONS Linux/KDE Plasma: Arch Linux KDE Plasma Version: 6.3.4 KDE Frameworks Version: 6.12.0 Qt Version: 6.8.3
Plasma comes with a built in clipboard manager, which intentionally prevents this.
Calling EmptyClipboard() on wine works, probably because it sets the clipboard to an empty string. Why force wayland clients to find workarounds instead of conforming to spec? Letting a user of my library call a function "clearClipboard()" and it just doesn't work is not really an option, so naturally I will use the same workaround.
This does conform to the spec. Clipboard managers are a thing, whether you like it or not. > Calling EmptyClipboard() on wine works, probably because it sets the clipboard to an empty string. That's a bug then, one that should be fixed.