clipboard-master
clipboard-master copied to clipboard
Wayland support?
It would be awesome if we can add Wayland support!
are you familiar with wayland? I don't really know it and whether there is proper API bindings. Considering how complicated X11 is, I wouldn't be surprised if Wayland itself would be pretty complicated stuff.
In addition to that it would probably require to introduce feature to use wayland instead of x11
It is very tricky to have proper support for Wayland. The Wayland standard protocol does not allow applications without a focused window to access the user clipboard, and compositors need to implement their own protocols for such use cases. wlroots-based compositors and KDE's KWin implement the wlr_data_control
protocol, but GNOME's Mutter does not. So there is no good way to support all Wayland environments. wl-clipboard uses a very nasty hack which spawns a 1x1 window first and hope for the compositor to auto focus that window, then start reading the clipboard.
For compositors does implement wlr_data_control
protocol, we have wl-clipboard-rs which implemented reading and writing using this protocol.
My own fork added very basic support to wayland for compositors implemented wlr_data_control
protocol. However, due to lacking of monitoring apis being implemented, it triggers the callback by checking if the hash of the contents in the clipboard has changed, and can only be used for pure text contents. This is not suitable for upstreaming but is good enough for my own project at the moment.