Closed CosmicToast closed 4 years ago
Yep, this is because of the focus stealing hack wl-clipboard has to do on Mutter.
If you want this to be fixed, ask Mutter developers to implement the wlr-data-control protocol; but be aware they've previously said they don't plan to do that.
Yep, this is because of the focus stealing hack wl-clipboard has to do on Mutter.
If you want this to be fixed, ask Mutter developers to implement the wlr-data-control protocol; but be aware they've previously said they don't plan to do that.
Hey, have you checked this MR ? . i know gnome devs are PITA but the windows stealing hack makes periodically checking clipboard for urls (every second) impossible.
I think the above MR has API to get clipboard content on Mutter and thus can be used in wl-clipboard
Hey, have you checked this MR ?
I have; you can see I even commented there at the time 🙂
I think the above MR has API to get clipboard content on Mutter and thus can be used in wl-clipboard
No. It's not an API for external programs; it was simply a change to how Mutter / GNOME Shell handles the clipboard internally.
Mutter has private D-Bus API for accessing clipboard now; but that is outside of scope for wl-clipboard.
You might want to use this version of Mutter that has wlr-data-control support (has to be rebased to a newer Mutter version though).
I have; you can see I even commented there at the time slightly_smiling_face
Yeah, i read the whole conversation afterwards.
You might want to use this version of Mutter that has wlr-data-control support (has to be rebased to a newer Mutter version though).
Wait, if the case was that someone would have to work on it and it would be very hard, then it would be understandable. But if the patch is already made by you, why haven't they merged it?
Also due to this focus stealing behavior of wl-clipboard, we cant check if there is anything new pasted on clipboard periodically. Any tips on how to do that?
Also Xclip (or Xsel) can copy and paste on wayland without stealing window focus on gnome, have you looked into their patches?
But if the patch is already made by you, why haven't they merged it?
You'd have to ask them. But presumably, they don't want the feature in Mutter at all.
One of the reasons they may not want it is security concerns: this would let any background app access the clipboard. IMO this is solvable (by only exposing the data-control global to non-sandboxed clients), but Mutter developers may disagree.
Any tips on how to do that?
Without data-control, on Mutter it is impossible for an external client to do that. You'd have a better chance to get this working by writing a GNOME Shell extension.
Also Xclip (or Xsel) can copy and paste on wayland without stealing window focus on gnome, have you looked into their patches?
There are no patches to speak of. The X11 clients all do the standard X11 thing. And last I checked, no, X11 clients were not able to access the Wayland clipboard without some XWayland window having focus. But this may have changed; it might be that Mutter lets any X11 client access the clipboard regardless of focus now.
@bugaevc Gpaste works fine with gnome in wayland without gnome-shell extension. None other clipboard managers (copyq) are able to do that afaik. Can you check its implementation
As far as I can see, GPaste's daemon uses GTK, and specifically GTK's X11 backend, internally. This may give it an advantage: as far as I know, Mutter propagates selection to XWayland even when no XWayland windows are focused; yet it doesn't allow unfocused X11 windows to set selection.
wl-clipboard only uses pure Wayland; not X11. You could try to use X11 clipboard tools though, if that works for you.
GPaste's daemon uses GTK's X11 backend internally. This may give it an advantage: as far as I know, Mutter propagates selection to XWayland even when no XWayland windows are focused; yet it doesn't allow unfocused X11 windows to set selection.
This explains why xclip is also able to get clipboard content on wayland without window focus
X11 clients were not able to access the Wayland clipboard without some XWayland window having focus.
I'm able to access mutter's clipboard through xcb bindings without any window focus changes. When I poll regularly, I get a ton of zombie cat
processes. One time I saw an error for having too many clients.
When I run
echo hi | wl-copy
, I see the terminal flash, as well as the descriptor line at the top-left, and I see a window start to appear in dash to dock. I originally noticed this via zyedidia/micro#1754, but I can reproduce it in a regular terminal as per above.wl-copy --version
: 2.0.0 Running on Fedora 32, Gnome Wayland 3.36.3.