Hey!
I am maintaining a command line python application currently packaged as a snap that need to write to the clipboard so that the user then can paste the result.
The python application is using pyperclip for the interaction with the clipboard for increased portability.
When running the application as a snap on the Librem 5, I get no error but also nothing in the clipboard to paste.
Trying out pyperclip in an python3 venv on the librem 5, pyperclip throws an exception telling me it cannot find a copy paste mechanism.
So⦠Ideas on what to try to get the snap copy pasting again? Or is this likely a pure os snap integration issue and if so where should I report that?
Pyperclip docs say it uses either xsel or xclip on the backend, neither of which is pre-installed on the Librem 5. Those, in turn, seem to make use of the X11 windowing system, whereas the Librem 5 uses Wayland by default. However, looking at the code for pyperclip, it seems like it should also be able to make use of wl-clipboard for Wayland sessions. This is also not pre-installed on the Librem 5, though.
Try sudo apt install wl-clipboard, then trying again.
Thanks for the suggestion, this would not be the first time wayland/x11 differences have caused my application copy paste issues.
After installing wl-clipboard the snap still does not write to the clipboard. The āregularā python script just running in a venv no longer complaints but still nothing showing up in the clipboard. Also tested using wl-copy directly without any results. Calling wl-paste works and happily pastes the most recent thing before I tried to run any of my scripts.
I would not be surprised if it is wayland related⦠But it something more is in the works. This all works on opensuse Tumbleweed using a GNOME desktop running on wayland.
Update: I got some help in the #community-librem-5:talk.puri.sm where they suggested I compile the latest version of wl-clipboard from github https://github.com/bugaevc/wl-clipboard
With the newer version of wl-clipboard both wl-copy and pyperclip started to work
However, the snap still does not write to the clipboard.
Is the snap being built with the freshly-compiled version of wl-clipboard ?
That is a good idea! Will try that.
Is there some permissions issue? Like, do you have to specifically allow clipboard access from the snap somehow?
There have been a lot of that type of issues but I those times pyperclip have thrown an exception warning me. So I am living on the hope that using the latest wl-clipboard will help.
Did not manage to sort out updating the snap wl-clipboard but very likley the snap is suffering from the old version as well. Using 2.0 in the flatpak works like a charm as long as I give it wayland priviliges.