So I’ve been wondering why some copy-and-paste actions “don’t work” on Wayland. Turns out, in Wayland there’s only one clipboard (like in probably most other OSes): The one where you select something and then hit ^C to copy it (it’s called the CLIPBOARD selection). They have intentionally not included the PRIMARY selection of X11 where you can just select some text to copy it and use the middle-mouse button to paste it.

Almost 10 years ago, they started an initiative to bring back PRIMARY:

https://wiki.gnome.org/Initiatives/Wayland/PrimarySelection

That protocol is still “unstable” and thus not every Wayland client supports it:

https://wayland.app/protocols/primary-selection-unstable-v1

I honestly didn’t really look into this before and I didn’t know that it’s still unstable/unsupported, hence my confusion. (To be fair, I don’t know for certain if that particular protocol is already 10 years old. It looks like it because the copyright notice at the bottom says so, but no idea if that’s a reliable source.)

This is one of those things that are very subjective. The Wayland guys apparently thought that it was a “usability problem” to have two clipboards, so they removed one of them. Actually, the mechanism of X11 is totally generic, there are an “infinite” number of clipboards and we have just settled on using only two.

This is an interesting topic because Wayland is so old now that it looks like it has missed the developments of the last ~10 years or more: Way back in the past, I was indeed very confused about the different X11 clipboards because some clients used CLIPBOARD (hit ^C) and others only used PRIMARY (middle-mouse) – but this has long settled down. Most clients now have something like ^C to explicitly copy data into CLIPBOARD and ^V to paste it. It’s the standard thing now. And then on top of that power-users can additionally use PRIMARY where you just select text. This is a good and powerful thing, if you ask me.

I use both clipboards all the time. My mental model knows where the data goes. PRIMARY is like a short-term clipboard and CLIPBOARD is long-term. I think this is much better than just having one clipboard and I kind of feel like making good use of this is what keeps me from having to install a clipboard manager.

⤋ Read More