I'm trying to understand how selection(i.e. Primary and Clipboard in X) works in Wayland. I've read a bit on it, and I understand that Xorg has many(three) buffers used for managing selection and copy/paste or 'drag and drop' manipulations, whereas Wayland only has one.
On X, I can use a variety of programs to access those buffers(xclip
, xsel
, etc), which can be very useful. For example, I have a shortcut that sends the text I have selected to a program(using xsel -p -o
), which then do stuff with that selection.
From what I understand, Wayland doesn't have a "primary" buffer which contains any selected text, but rather only a "clipboard" buffer which only contains text explicitly copied(e.g. using a shortcut). That's all fine and good, but surely that doesn't prevent an equivalent of xsel
from existing in Wayland? Could I still set a shortcut to simultaneously copy the selection and send it to another program? How would that be done?
Yes, you can use bugaevc's wl-clipboard in Wayland instead of X11's xclip.
From what I understand, Wayland really specifies only one clipboard buffer. But implementations seek to support more functionality, see e.g. a GNOME statement on primary selection support or swaywm's decision to implement it as a Wayland compositor. On my running Wayland-system, primary clipboard (select + middle mouse-button) works out of the box.