While fixing a problem with a Wayland app I noticed that the programm got a notification from a Wayland fd whenever I selected some text in any other window (not belonging to the app) and was able to read the contents of the selection.
As I’m not a fan of sharing data without explicit actions (so Ctrl+C, Ctrl+V), is there a way to disable this behaviour of Wayland?
OS info: Fedora 43 KDE


What is the application and did you notice similar behavior outside of it, e.g. being able to paste the currently selected text? I would also check your clipboard manager’s configuration. Clipboards (usually) have a clipboard buffer (for CTRL + C -> CTRL + V) and a primary buffer (for selected text -> mouse middle button paste). Some problems arise from the confusing default settings of some clipboard managers, e.g. the synchronization of both buffers.
The application was MPV. At random time it started consuming 100% of one core for a long time. I could track it down to the clipboard thread where a loop polls Wayland to get the latest content of the clipboard (selected text). Seems like a bug in some other application spamms this clipboard buffer from time to time and so caused the MPV loop to run continously.
This way I learned about that Wayland API and as MPV can emit logs whenever the poll loop got new data, I was able to see that it fired whenever I selected text in some application.
Good to know the name of this feature; primary buffer. Now I need to find a way to disable it.