clipster icon indicating copy to clipboard operation
clipster copied to clipboard

Support Wayland

Open ghost opened this issue 6 years ago • 10 comments

Currently clipster fails on wayland (wm: sway). The stacktrace reports that libwnck is "designed to work under X11 only".

I fear this is going to be difficult to fix. If I understand correctly, wayland makes getting data from other windows very difficult (for security reasons). Clipit too doesn't run on wayland.

ghost avatar Jul 21 '17 19:07 ghost

Thanks for raising this - I've been mostly trying to ignore it :smiley:

My reading up on this (along with your Gnome bug report) makes it clear that this is a complicated migration. As such there's a possibility that moving to Wayland might be a 'start again' kind of operation, rather than an update to the current app.

I'll leave this bug open as a place to gather more information on how the clipboard will work in Wayland, and in case anyone else wants to know about support, but for now this is definitely a 'wait and see' situation.

mrichar1 avatar Jul 22 '17 16:07 mrichar1

FYI https://blog.martin-graesslin.com/blog/2016/07/synchronizing-the-x11-and-wayland-clipboard/

akostadinov avatar Dec 19 '17 10:12 akostadinov

Thanks for the extra info!

I'm still not quite at the point where I can put any effort into looking at wayland support (for one thing I don't have wayland running anywhere handy) though I will have to at some point. It looks like Gtk+ has extended their clipboard module to support Wayland, though documentation is really thin on the ground, so I've no idea to what extent things will 'just work'.

libwnck is used by filter_classes by application - this is going to have to be refactored anyway if my understanding of how the wayland clipboard works is correct.

It'd be interesting if anyone with wayland running can edit clipster and comment out the following lines:

try:
    require_version("Wnck", "3.0")
    from gi.repository import Wnck
except (ImportError, ValueError):

and unindent Wnck = None

and see what happens when clipster is run (with filter_classes = no in the config)?

mrichar1 avatar Dec 19 '17 16:12 mrichar1

I tried it some time ago, but it wasn't enough because wayland applications don't get notified of ownership changes, so the core functionality is broken too. I believe that window managers will need to implement the listening part, whereas clipboard managers will just retrieve the info when asked by the user — very very simplified code, but will need custom retrievers for each window manager. You can follow this sway issue and this other for their (TBD) api, which will probably work for all wlroots-based wms.

ghost avatar Dec 19 '17 19:12 ghost

libwnck is used by filter_classes by application - this is going to have to be refactored anyway if my understanding of how the wayland clipboard works is correct.

If you ever get around to refactor it, may I suggest to make the filter inclusive instead of exclusive? By that I mean, only programs included in the filter will get processed, like a whitelist (instead of a blacklist currently).

glubsy avatar Jan 05 '18 21:01 glubsy

@glubsy I think most people want a blacklist (the usual use case is collect everything except a password manager) hence the reason it was implemented that way.

I could make it so that there is both a blacklist and a whitelist (ordering/priority tbd...) if this is useful. Please can you make this a new issue as a feature request, as it will get lost in the wayland discussion, and if it in turn gets discussed will distract from the original issue. Thanks!

mrichar1 avatar Jan 11 '18 17:01 mrichar1

@ghost, @mrichar1: the above mentioned wlroots implementation has been moved upstream https://github.com/swaywm/wlr-protocols/pull/25 and if your are interested, this project implements it: https://github.com/bugaevc/wl-clipboard

wl-clipboard is a simple cli/pipes based application along the same vein of xclip, and might make a fairly trivial implementation, depending on how tightly you want to bind to wayland protocols.

zetorian avatar Jan 22 '19 04:01 zetorian

@zetorian thanks for flagging this up! given that clipster is currrntly working at a high level using the Python Gtk libs, then it's unlikely that I can pursue any work on a wayland-clipster until a similar API/ABI exists in Gtk/Qt/other python lib. Of course if someone wanted to write a wrapper around the protocol that clipster could tie into... :smiley:

mrichar1 avatar Jan 30 '19 14:01 mrichar1

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Apr 16 '22 14:04 stale[bot]