Diodon support for wayland

Bug #1727042 reported by Olivier Febwin
28
This bug affects 5 people
Affects Status Importance Assigned to Milestone
Diodon
Fix Released
High
Unassigned

Bug Description

Big problems on gnome shell (ubuntu 17.10)

Revision history for this message
Oliver Sauder (sao) wrote :

Up to know I couldn't reproduce the problem on my VirtualBox and Ubuntu 17.10. Diodon works just fine.

I had other bug reports and questions though where Diodon is not running. I assume though the problem is more with Wayland than Gnome Shell.

Could you try to start Ubuntu on Xorg and see whether the problem persist?

See how to do so
https://askubuntu.com/questions/961304/how-do-you-switch-from-wayland-back-to-xorg-in-ubuntu-17-10

Revision history for this message
Oliver Sauder (sao) wrote :

I could reproduce it now. The cause of the issue is definitely Wayland. When I run on Xorg it seems to work fine.

Diodon uses quite a few X features so not quite sure how easy it is to migrate. As a workaround is to run in xorg (as I assume also other apps will have problems).

summary: - gnome shell
+ Diodon support for wayland
Revision history for this message
Xavier Guillot (valeryan-24) wrote :

Hi, I confirm the problem with Diodon and Wayland on default Ubuntu 17.10 session : it runs fine and is well shown as AppIndicator but does not save any clipboard entry : history remains empty and so of course impossible to select anything...

Yes, some other apps don't work anymore on Wayland, especially those requiring graphic root privileges Gparted, Synaptic, Shutter...) but most users will keep the default session, I hope it will be possible to adapt it (no idea how difficult it is on coding aspect).

Thanks !

Revision history for this message
Oliver Sauder (sao) wrote :

I have looked into this a bit more but this seems harder than I have anticipated.

Following features rely on X:
* instant paste - this causes crashes on Wayland but can be disabled in the Diodon preferences
* detection of what application copy has come from - needed for blacklisting of applications - small changes in code needed to disable this in wayland

Those features I understand that they don't work but that the GtkClipboard doesn't work is fairly surprising The documentation [0] says it is compatible with Wayland but I couldn't get it to work. It just never picks up the content of clipboard - always empty.

I will need to investigate it more potentially reading GTK code. Not sure when I will find time - any hints and directions are welcome.

[0] https://wiki.gnome.org/Initiatives/Wayland/GTK%2B

Revision history for this message
Xavier Guillot (valeryan-24) wrote :

I'm unable to help you regarding coding.

Just, unlike graphic root privileges (Synaptic, Gparted) or modifying screenshot selection on the screen (Shutter), perhaps this is not due to a Wayland security restriction : I just installed and tested Copyq and it works for the clipboard history.

So perhaps the source could let you understand the issue :
https://github.com/hluk/CopyQ

Nevertheless, thanks for having taken time to look at this bug, I appreciate Diodon a lot !

Revision history for this message
Oliver Sauder (sao) wrote :

I have figured out what the problem is.

Wayland seems to have a security feature that only applications which have the focus can read the clipboard. The documentation https://wayland.freedesktop.org/docs/html/ch04.html#sect-Protocol-data-sharing doesn't mention this though but tests I made through GTK showed exactly this behaviour.

To workaround this what I did is to force Diodon to run in backwards compatibility mode (XWayland). But this doesn't fix the problem totally as events of clipboard change are not properly implemented between Wayland and XWayland apps.
All other clipboard managers I have analysed (including CopyQ) have a timer which constantly checks the clipboard for changes and therefore still kind of work. But I think it is fairly bad practice to constantly wake up the CPU in an application which always runs in the background.

In the daily ppa https://launchpad.net/~diodon-team/+archive/ubuntu/daily I have published a Diodon version which runs on XWayland.
When you run it you will see nicely when you copy text from a X application (e.g. Firefox) it will show up in the clipboard history. But if you copy it from a native Wayland application (e.g. Gedit) it won't.

It seems to implement a clipboard manager properly (without X11 backend and timer hacks) a change in Wayland is needed - maybe it is possible to write a plugin but I do not really have a good insight into Wayland to decide this.

To sum up:
Code quality and good integration into DE (mainly Unity) has always been a motivator for building Diodon in the first place.
It seems though that Diodon in its current state doesn't live up to this standards when being run on Wayland.
Not just because it would need above explained hacks but other features like instant paste, blacklisting of applications and keybinding support do not work either.

I haven't decided yet (need to sleep on this one I guess... :)) but I am considering not to support Wayland with Diodon till it can be well integrated. I guess if it comes to this Diodon should stop automatically on Wayland and show a proper error message.
Feel free to comment.

Revision history for this message
Olivier Febwin (febcrash) wrote :

It works!
Thanks for this fix Oliver!

Revision history for this message
Oliver Sauder (sao) wrote :

Thanks Olivier for your feedback.

Can you confirm that clipboard content always appears in the clipboard history? I assume you use Ubuntu 17.10?

On my VirtualBox Ubuntu 17.10 test environment occasionally when copying from a Wayland application (mainly Gnome Terminal) content doesn't show up in history (as clipboard change is not triggered by Wayland it seems). I tested on another physical machine on one of my colleagues with Wayland and there clipboard always worked with this fix. It was on a different distribution though.

Results are a bit mixed and I am wondering whether the problem simple appears with VirtualBox.

Revision history for this message
Olivier Febwin (febcrash) wrote :

Yes! Diodon 1.7.0~201711181631~ubuntu17.10.1 works fine on ubuntu 17.10 on Wayland session on my physical machine.

It's ok on Gnome-Terminal

Revision history for this message
Olivier Febwin (febcrash) wrote :

clipboard content always appears in the clipboard history

Oliver Sauder (sao)
Changed in diodon:
importance: Undecided → High
status: New → Fix Committed
milestone: none → 1.7.0
Revision history for this message
Oliver Sauder (sao) wrote :

Released Diodon version 1.7.0 with initial Wayland support as described in this bug report.

There are potentially other Wayland issues. If you find any please report them in new bug reports.

Changed in diodon:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Related questions

Remote bug watches

Bug watches keep track of this bug in other bug trackers.