Betterbird / thunderbird-patches

Betterbird is a fork of Mozilla Thunderbird. Here are the patches that provide all the goodness.
Other
501 stars 21 forks source link

Restore from tray in flatpak wayland #214

Closed Zahrun closed 11 months ago

Zahrun commented 1 year ago

Hi there,

Thank you for the good work on tray icon support in linux systems.

I noticed a small issue with the flatpak version of Betterbird when running in a wayland session. Clicking on the tray icon to restore betterbird does not show the window immediatly. I have to click an unconsistent number of times before it shows up. I also noticed that if I point my cusor to the icon, and then click repetedly without moving the cursor, betterbird will not show up, whatever number of times I click. This does not happen with the binary non-flatpak version of betterbird in wayland nor with the flatpak version in x11.

I’m trying this with 115.3.2-bb15 in each scenario.

Operating System: TUXEDO OS 2 KDE Plasma Version: 5.27.8 KDE Frameworks Version: 5.110.0 Qt Version: 5.15.10 Kernel Version: 6.2.0-10027-tuxedo (64-bit) Graphics Platform: Wayland

Betterbird commented 1 year ago

@mfschumann ?

mfschumann commented 1 year ago

Are you using the Wayland backend as described here or are you running BB with the default X11 backend?

Zahrun commented 1 year ago

I’m using the X11 backend in wayland (xwayland).

If I use the wayland backend, I don’t get a tray icon at all. PS: that is with the flatpak version.

If I use the wayland backend with the binary version, I get a tray icon, but betterbird does not minimize there, and clicking on the tray icon does nothing. So I just use the X11 backend with the binary version and everything is fine there.

Zahrun commented 1 year ago

Ah I found a solution to this issue: give socket=session-bus permission to the flatpak. Now it works correctly. A negative side effect is that the tray icon does not have an icon, it is pure transparent.

socket=session-bus also helps if I run betterbird flatpak with the wayland backend, as the tray icon is there, minimise does minize to the task bar instead of the tray, but clicking on the tray icon does something, it makes betterbird blink in the taskbar (which is somehow more than what the binary version of betterbird does)

So I guess give socket=session-bus permission to the flatpak by default and I will consider this issue solved. We can treat the rest separately.

mfschumann commented 1 year ago

Thanks for debugging the issue.

Adding the socket=session-bus permission is discouraged. It would be better to restrict D-Bus permissions to what is actually needed. In order to find the right permission to add: Could you please disable the socket=session-bus permission, run flatpak run --log-session-bus eu.betterbird.Betterbird, provoke the issue, and upload the log that you get?

I would do it myself but I cannot reproduce the issue in my Gnome session on Fedora.

Zahrun commented 1 year ago
flatpak run --log-session-bus eu.betterbird.Betterbird
C1: -> org.freedesktop.DBus call org.freedesktop.DBus.Hello at /org/freedesktop/DBus
C2: -> org.freedesktop.DBus fake wildcarded AddMatch for eu.betterbird.Betterbird
C3: -> org.freedesktop.DBus fake wildcarded AddMatch for org.mpris.MediaPlayer2.eu.betterbird.Betterbird
C4: -> org.freedesktop.DBus fake wildcarded AddMatch for org.mozilla.betterbird
C5: -> org.freedesktop.DBus fake wildcarded AddMatch for org.freedesktop.portal
C6: -> org.freedesktop.DBus fake AddMatch for org.a11y.Bus
C7: -> org.freedesktop.DBus fake GetNameOwner for org.a11y.Bus
C8: -> org.freedesktop.DBus fake ListNames
B1: <- org.freedesktop.DBus return from C1
B2: <- org.freedesktop.DBus signal org.freedesktop.DBus.NameAcquired at /org/freedesktop/DBus
B3: <- org.freedesktop.DBus return from C2
*SKIPPED*
B4: <- org.freedesktop.DBus return from C3
*SKIPPED*
B5: <- org.freedesktop.DBus return from C4
*SKIPPED*
B6: <- org.freedesktop.DBus return from C5
*SKIPPED*
B7: <- org.freedesktop.DBus return from C6
*SKIPPED*
B8: <- org.freedesktop.DBus return from C7
*SKIPPED*
B9: <- org.freedesktop.DBus return from C8
C9: -> org.freedesktop.DBus fake GetNameOwner for org.freedesktop.DBus
C10: -> org.freedesktop.DBus fake GetNameOwner for org.freedesktop.portal.Desktop
C11: -> org.freedesktop.DBus fake GetNameOwner for org.freedesktop.portal.Documents
C12: -> org.freedesktop.DBus fake GetNameOwner for org.a11y.Bus
*SKIPPED*
C13: -> org.mozilla.betterbird.QXJvdW4_ call org.mozilla.betterbird.OpenURL at /org/mozilla/betterbird/Remote
B10: <- org.freedesktop.DBus return from C9
*SKIPPED*
B11: <- org.freedesktop.DBus return from C10
*SKIPPED*
B12: <- org.freedesktop.DBus return from C11
*SKIPPED*
B13: <- org.freedesktop.DBus return from C12
*SKIPPED*
B14: <- org.freedesktop.DBus return error org.freedesktop.DBus.Error.ServiceUnknown from C13
C1: -> org.freedesktop.DBus call org.freedesktop.DBus.Hello at /org/freedesktop/DBus
C2: -> org.freedesktop.DBus fake wildcarded AddMatch for eu.betterbird.Betterbird
C3: -> org.freedesktop.DBus fake wildcarded AddMatch for org.mpris.MediaPlayer2.eu.betterbird.Betterbird
C4: -> org.freedesktop.DBus fake wildcarded AddMatch for org.mozilla.betterbird
C5: -> org.freedesktop.DBus fake wildcarded AddMatch for org.freedesktop.portal
C6: -> org.freedesktop.DBus fake AddMatch for org.a11y.Bus
C7: -> org.freedesktop.DBus fake GetNameOwner for org.a11y.Bus
C8: -> org.freedesktop.DBus fake ListNames
B1: <- org.freedesktop.DBus return from C1
B2: <- org.freedesktop.DBus signal org.freedesktop.DBus.NameAcquired at /org/freedesktop/DBus
B3: <- org.freedesktop.DBus return from C2
*SKIPPED*
B4: <- org.freedesktop.DBus return from C3
*SKIPPED*
B5: <- org.freedesktop.DBus return from C4
*SKIPPED*
B6: <- org.freedesktop.DBus return from C5
*SKIPPED*
B7: <- org.freedesktop.DBus return from C6
*SKIPPED*
B8: <- org.freedesktop.DBus return from C7
*SKIPPED*
B9: <- org.freedesktop.DBus return from C8
C9: -> org.freedesktop.DBus fake GetNameOwner for org.freedesktop.DBus
C10: -> org.freedesktop.DBus fake GetNameOwner for org.freedesktop.portal.Desktop
C11: -> org.freedesktop.DBus fake GetNameOwner for org.freedesktop.portal.Documents
C12: -> org.freedesktop.DBus fake GetNameOwner for org.a11y.Bus
*SKIPPED*
C13: -> org.freedesktop.DBus call org.freedesktop.DBus.AddMatch at /org/freedesktop/DBus
C14: -> org.freedesktop.DBus call org.freedesktop.DBus.AddMatch at /org/freedesktop/DBus
C15: -> org.freedesktop.DBus call org.freedesktop.DBus.AddMatch at /org/freedesktop/DBus
C16: -> org.freedesktop.DBus call org.freedesktop.DBus.StartServiceByName at /org/freedesktop/DBus
B10: <- org.freedesktop.DBus return from C9
*SKIPPED*
B11: <- org.freedesktop.DBus return from C10
*SKIPPED*
B12: <- org.freedesktop.DBus return from C11
*SKIPPED*
B13: <- org.freedesktop.DBus return from C12
*SKIPPED*
B14: <- org.freedesktop.DBus return from C13
B15: <- org.freedesktop.DBus return from C14
B16: <- org.freedesktop.DBus return from C15
B17: <- org.freedesktop.DBus return from C16
C17: -> org.freedesktop.DBus call org.freedesktop.DBus.GetNameOwner at /org/freedesktop/DBus
B18: <- org.freedesktop.DBus return from C17
C18: -> :1.19 call org.freedesktop.DBus.Properties.GetAll at /org/freedesktop/portal/desktop
B3998: <- :1.19 return from C18
C19: -> :1.19 call org.freedesktop.portal.Settings.Read at /org/freedesktop/portal/desktop
B4001: <- :1.19 return from C19
C1: -> org.freedesktop.DBus call org.freedesktop.DBus.Hello at /org/freedesktop/DBus
C2: -> org.freedesktop.DBus fake wildcarded AddMatch for eu.betterbird.Betterbird
C3: -> org.freedesktop.DBus fake wildcarded AddMatch for org.mpris.MediaPlayer2.eu.betterbird.Betterbird
C4: -> org.freedesktop.DBus fake wildcarded AddMatch for org.mozilla.betterbird
C5: -> org.freedesktop.DBus fake wildcarded AddMatch for org.freedesktop.portal
C6: -> org.freedesktop.DBus fake AddMatch for org.a11y.Bus
C7: -> org.freedesktop.DBus fake GetNameOwner for org.a11y.Bus
C8: -> org.freedesktop.DBus fake ListNames
B1: <- org.freedesktop.DBus return from C1
B2: <- org.freedesktop.DBus signal org.freedesktop.DBus.NameAcquired at /org/freedesktop/DBus
B3: <- org.freedesktop.DBus return from C2
*SKIPPED*
B4: <- org.freedesktop.DBus return from C3
*SKIPPED*
B5: <- org.freedesktop.DBus return from C4
*SKIPPED*
B6: <- org.freedesktop.DBus return from C5
*SKIPPED*
B7: <- org.freedesktop.DBus return from C6
*SKIPPED*
B8: <- org.freedesktop.DBus return from C7
*SKIPPED*
B9: <- org.freedesktop.DBus return from C8
C9: -> org.freedesktop.DBus fake GetNameOwner for org.freedesktop.DBus
C10: -> org.freedesktop.DBus fake GetNameOwner for org.freedesktop.portal.Desktop
C11: -> org.freedesktop.DBus fake GetNameOwner for org.freedesktop.portal.Documents
C12: -> org.freedesktop.DBus fake GetNameOwner for org.a11y.Bus
*SKIPPED*
B10: <- org.freedesktop.DBus return from C9
*SKIPPED*
B11: <- org.freedesktop.DBus return from C10
*SKIPPED*
B12: <- org.freedesktop.DBus return from C11
*SKIPPED*
B13: <- org.freedesktop.DBus return from C12
*SKIPPED*
Crash Annotation GraphicsCriticalError: |[0][GFX1-]: glxtest: Could not connect to wayland socket (t=0.421173) [GFX1-]: glxtest: Could not connect to wayland socket
Crash Annotation GraphicsCriticalError: |[0][GFX1-]: glxtest: Could not connect to wayland socket (t=0.421173) |[1][GFX1-]: More than 1 GPU vendor detected via PCI, cannot deduce vendor
 (t=0.421218) [GFX1-]: More than 1 GPU vendor detected via PCI, cannot deduce vendor

Crash Annotation GraphicsCriticalError: |[0][GFX1-]: glxtest: Could not connect to wayland socket (t=0.421173) |[1][GFX1-]: More than 1 GPU vendor detected via PCI, cannot deduce vendor
 (t=0.421218) |[2][GFX1-]: PCI candidate 0x8086/0x3e9b
 (t=0.421231) [GFX1-]: PCI candidate 0x8086/0x3e9b

Crash Annotation GraphicsCriticalError: |[0][GFX1-]: glxtest: Could not connect to wayland socket (t=0.421173) |[1][GFX1-]: More than 1 GPU vendor detected via PCI, cannot deduce vendor
 (t=0.421218) |[2][GFX1-]: PCI candidate 0x8086/0x3e9b
 (t=0.421231) |[3][GFX1-]: PCI candidate 0x10de/0x1f91
 (t=0.421247) [GFX1-]: PCI candidate 0x10de/0x1f91

C14: -> org.a11y.Bus call org.freedesktop.DBus.Properties.Get at /org/a11y/bus
B488: <- :1.24 return from C14
C15: -> org.freedesktop.DBus call org.freedesktop.DBus.RequestName at /org/freedesktop/DBus
B14: <- org.freedesktop.DBus signal org.freedesktop.DBus.NameOwnerChanged at /org/freedesktop/DBus
B15: <- org.freedesktop.DBus signal org.freedesktop.DBus.NameAcquired at /org/freedesktop/DBus
B16: <- org.freedesktop.DBus return from C15
B14: <- org.freedesktop.DBus signal org.freedesktop.DBus.NameOwnerChanged at /org/freedesktop/DBus
B14: <- org.freedesktop.DBus signal org.freedesktop.DBus.NameOwnerChanged at /org/freedesktop/DBus
C20: -> org.freedesktop.DBus call org.freedesktop.DBus.AddMatch at /org/freedesktop/DBus
C21: -> org.freedesktop.DBus call org.freedesktop.DBus.GetNameOwner at /org/freedesktop/DBus
C22: -> org.freedesktop.DBus call org.freedesktop.DBus.GetNameOwner at /org/freedesktop/DBus
C13: -> org.freedesktop.portal.IBus call org.freedesktop.DBus.Peer.Ping at /org/freedesktop/IBus
B19: <- org.freedesktop.DBus return from C20
B20: <- org.freedesktop.DBus return error org.freedesktop.DBus.Error.NameHasNoOwner from C21
B21: <- org.freedesktop.DBus return error org.freedesktop.DBus.Error.NameHasNoOwner from C22
B15: <- org.freedesktop.DBus return error org.freedesktop.DBus.Error.ServiceUnknown from C13
Betterbird: Window NOT minimized to system tray!
            You are using desktop environment .
            Minimize to system tray is only supported for these desktops:
            kde,gnome,xfce,mate.
            As an experiment, add  to preference
            mail.minimizeToTray.supportedDesktops.
            You might not be able to maximize the window again and
            will have to kill Betterbird.
            USE AT YOUR OWN RISK! If successful, contact support@betterbird.eu

C23: -> org.freedesktop.DBus call org.freedesktop.DBus.AddMatch at /org/freedesktop/DBus
C24: -> org.freedesktop.DBus call org.freedesktop.DBus.GetNameOwner at /org/freedesktop/DBus
Filtering message due to arg0 org.kde.StatusNotifierWatcher, policy: 0 (required 1)
B22: <- org.freedesktop.DBus return from C23
B23: <- (no sender) return from C24
*REWRITTEN*
C25: -> all signal org.kde.StatusNotifierItem.NewTitle at /org/ayatana/NotificationItem/Betterbird_systray_icon
C26: -> all signal org.kde.StatusNotifierItem.NewToolTip at /org/ayatana/NotificationItem/Betterbird_systray_icon
C27: -> all signal org.kde.StatusNotifierItem.NewStatus at /org/ayatana/NotificationItem/Betterbird_systray_icon
C28: -> all signal org.kde.StatusNotifierItem.NewStatus at /org/ayatana/NotificationItem/Betterbird_systray_icon

Even though betterbird is saying that the window is not minimized to tray, it only does that once at startup, whether native binary or flatpak so that’s a different issue that I plan to open separately.

mfschumann commented 11 months ago

I have done some testing with Wayland on Tuxedo OS myself and was able to reproduce the behavior you describe. I found that when adding the talk permission for org.kde.StatusNotifierWatcher I got the same results as for socket=session-bus.

@Zahrun Could you please confirm that this solves the issue for you, too? You can either add that permission using Flatseal or install the test build containing the permission by default: https://github.com/flathub/eu.betterbird.Betterbird/pull/136 In either case don't forget to remove the socket=session-bus permission before.

Zahrun commented 11 months ago

I removed session-bus permission and added org.kde.StatusNotifierWatcher session bus talk permission. I confirm that this solves the restore issue. The systray item has no icon though, it is fully transparent.

mfschumann commented 11 months ago

Thanks for testing. I get the transparent icon, too. But that's not different from when I use socket=session-bus. @Zahrun Do you get a visible icon with socket=session-bus?

Zahrun commented 11 months ago

No, the result is the same, but I got confused regarding the other issue with blurry icon since the test version has actually no icon.

The present issue here can be closed, I guess.

mfschumann commented 11 months ago

Ok, let's close this issue to avoid further confusion. Please be aware that I will ship the talk permission for org.kde.StatusNotifierWatcher as default only after the remaining issue (blurriness vs. invisibility of the icon) has been fixed. I'll track that issue in https://github.com/flathub/eu.betterbird.Betterbird/issues/78

@Betterbird Could you close this issue please?