Betterbird / thunderbird-patches

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

Support "minimise to tray" on Linux #111

Closed Betterbird closed 1 year ago

Betterbird commented 1 year ago

From https://github.com/Betterbird/thunderbird-patches/issues/20#issuecomment-1383105403:

Check this question and this answer. It's now tracked here: https://bugzilla.mozilla.org/show_bug.cgi?id=1627479 Getting the indicator in the systray (Issue #20) was hard enough and still doesn't work fully on Gnome. Hiding the taskbar "button" to instead show the icon seems even harder. Or is there some API that can do it? Or maybe the code from this add-on https://addons.thunderbird.net/en-GB/thunderbird/addon/minimizetotray-reanimated/ could be used.

Betterbird commented 3 months ago

First of all, there is some confusion here. For system tray and minimise to tray to work, your Linux desktop needs to provide a system tray. As you can see in https://github.com/Betterbird/thunderbird-patches/issues/111#issuecomment-2138996896, some desktops support this, Gnome only after an additional software installation.

Reading https://askubuntu.com/questions/18078/what-is-the-difference-between-a-desktop-environment-and-a-window-manager, there is a difference between desktop and windows manager. We're running Xfce with xfwm4, KDE with KWin, Mate with Metacity and Gnome with "GNOME Shell".

The system tray support depends on the desktop environment. That's why BB on Linux, when run from the command, line reports the DE is has detected.

Why don't you read the comment above again, run BB from the command line and see which DE it reports? You can add the DE name string to pref mail.minimizeToTray.supportedDesktops and see whether it works.

BTW, your comment https://github.com/Betterbird/thunderbird-patches/issues/111#issuecomment-2138845801 is unclear. Which icon do you click? The close button will always close the application. And minimise to tray needs to be enabled via an option.

Over to you to provide the necessary details instead of a "doesn't work".

dark-penguin commented 3 months ago

@lockie Tray functionality sucks because it's implemented via GTK3 - and we can't change this because that's what Thunderbird uses. And GTK3 is that famous one when the Gnome devs decided that they have their vision for the future of desktop computing, and that future does not have trays at all (and made Gnome 3). :face_with_spiral_eyes: So the only way to have an icon is to use something called libayatana-appindicator, which does not make things easy either. And on top of all that, each DE has their own tray implementation... and there are multiple different protocols...

If you are curious to see what we had to go through to make this work at all, and pick up where we left, there are a few issues around the time of this one (numbered something about 100-111 IIRC). There's even a minimal test source to fiddle around with. There are a couple different issues for different DEs, so we had to implement an option to switch between the behaviour that doesn't work on KDE and the one that doesn't work on MATE. :dizzy_face: So if you can figure out how to get tray icons working in your DE, and it doesn't break the other ones too much, then it could potentially be added as well. (I'm not a core dev though - I just did the same for MATE to get it working for me. :slightly_smiling_face: )

Betterbird commented 3 months ago

Right.

Since competition is good for business, the TB folks have now started to implement something themselves: https://bugzilla.mozilla.org/show_bug.cgi?id=18732 https://phabricator.services.mozilla.com/D211940 https://github.com/thunderbird/linux-sys-tray

Good luck to them.

lockie commented 3 months ago

Right, I wasn't providing enough details. I'm using polybar panel to display a system tray. Betterbird correctly identifies my desktop as xmonad, and I already have added it to mail.minimizeToTray.supportedDesktops. Thing is, tiling window managers do not have the concept of "minimizing" windows per se, so it'd be nice if BB would minimize by clicking on the icon. Or perhaps minimize to tray instead of closing when the window gets the close event.

dark-penguin commented 3 months ago

Thing is, tiling window managers do not have the concept of "minimizing" windows per se

Then that's the problem. @Betterbird refuses to make it minimize on tray icon click, in order to keep the behaviour consistent with Windows, so if you don't have a way to issue a "minimize" command normally, there's no other way to do it.

I do remember some discussion about minimizing instead of closing, but I don't remember @Betterbird 's position on it...

Betterbird commented 3 months ago

Hmm, not enough details. You haven't stated whether "minimise to tray" is actually selected as an option: image

You've added xmonad to pref mail.minimizeToTray.supportedDesktops and then what happened? But you're saying that your wm doesn't have a concept of minimising? How do you want to minimise if the wm doesn't support it? Behind the scenes, we're using libayatana-appindicator and that's doing a bunch of Gtk and dbus calls at the backend. If the receiving wm or DE doesn't do the "right thing", we won't be able to fix it.

Next you talk about "the icon", but there are several, at least one to minimise and one to closes.

With the add-on https://addons.thunderbird.net/en-us/thunderbird/addon/minimize-on-close/ you can change the action of the close icon, the app will minimise instead, but then again, I don't know whether minimise means anything in you wm.

lockie commented 3 months ago

The Minimize on close addon looks promising, but it does nothing on a WM - the window just blinks and then reappears again.

Betterbird commented 3 months ago

Look like your system is just too different for anything to work. We don't have the resources to analyse it. Likely it's a problem in the wm anyway.

Let's see whether TB's own system tray support will work better when they ship it in 2026.

doronbehar commented 3 months ago

I see that this thread is old, but a alive. I too can't get system tray support to work. Here are my settings:

image

Any my betterbird version:

image

I'm using NixOS (Thanks to @SuperSandro2000 who packaged it for us). I also have a full build log of Betterbird to share (sharing it so you could maybe find a patch we are missing or something alike):

https://cache.nixos.org/log/q6cw2g05v27jypqyni60rpnzvdjsp11i-betterbird-unwrapped-115.9.0.drv

On the contrary, the flatpak version of this does show the systray, and together with minimize-on-close the experience is perfect.

Still I'd like to get this working natively on NixOS.

Betterbird commented 3 months ago

I think that if the FlatPak works but the NixOS build doesn't then that wasn't built correctly. Hard to say. Have you tried our binary release (.tar.bz2 files)?

Looks like these patches 12-feature-linux-systray.patch 12-feature-linux-systray-compile.patch 12-feature-linux-systray-tooltip.patch 12a-feature-linux-systray-tooltip.patch 12-feature-linux-systray-no-root.patch 12-feature-linux-systray-example.patch 13-feature-linux-systray-activate.patch 13-feature-linux-systray-activate-xfce.patch 13-feature-linux-systray-activate-mate.patch 12+13-feature-linux-systray-incl-minimise.patch were successfully applied. It's strange though that these lines occur:

Checking patch third_party/appindicator/app-indicator.c...
Hunk #1 succeeded at 125 (offset 1 line).
Hunk #2 succeeded at 708 (offset 1 line).
Hunk #3 succeeded at 1366 (offset 2 lines)

I don't know how the patches are applied, let's assume the patches all applied and only the process is more noisy.

doronbehar commented 3 months ago

@Betterbird I suspect that this is related to Ayatana dependency not available during the build. For sure our package libayatana-appindicator (built from this source), is not added to the build. If this is indeed the reason. I'm surprised that the build didn't fail due to this missing dependency. I'm also wondering why didn't the build log mention even a search for this dependency.

Betterbird commented 3 months ago

No. We include the library ourselves.

doronbehar commented 3 months ago

I think that if the FlatPak works but the NixOS build doesn't then that wasn't built correctly. Hard to say. ... It's strange though that these lines occur:

Checking patch third_party/appindicator/app-indicator.c...
Hunk #1 succeeded at 125 (offset 1 line).
Hunk #2 succeeded at 708 (offset 1 line).
Hunk #3 succeeded at 1366 (offset 2 lines)

This is how we do it:

https://github.com/NixOS/nixpkgs/blob/9b19ff75c0338513ee5732ab8ebfd58ac7e5a770/pkgs/applications/networking/mailreaders/betterbird/default.nix#L56-L95

Betterbird commented 3 months ago

OK, the git apply -v makes it more noisy. I'm not thrilled that you remove 14-feature-regexp-searchterm.patch. In the current version there are more patches relying on ICU.

Other than that, I can't tell why the system tray stuff doesn't work.

doronbehar commented 3 months ago

OK, the git apply -v makes it more noisy. I'm not thrilled that you remove 14-feature-regexp-searchterm.patch. In the current version there are more patches relying on ICU.

Other than that, I can't tell why the system tray stuff doesn't work.

Maybe @SuperSandro2000 will have a clue :pray:.

MarsAstro commented 1 month ago

The minimize option doesn't seem to work right on Linux Mint 22 Cinnamon edition either. I've installed Betterbird via the Software Manager (Flathub), and with the option on minimizing leaves the app on the bar instead of moving it to tray.

Betterbird commented 1 month ago

Cinnamon doesn't work: http://www.betterbird.eu/expert-tips/

Thanks for confirming.

MarsAstro commented 1 month ago

Cinnamon doesn't work: http://www.betterbird.eu/expert-tips/ Thanks for confirming.

Ah, I see! Is this a limitation with the distro, or is it something that could potentially be fixed in future updates?

Betterbird commented 1 month ago

No intention to work around quirks of the various desktops. It works for KDE, Gnome, Xfce and Mate, and Mate was already a pain to get working.

Besides, the TB folks have just implemented their own system tray support written in Rust: https://github.com/thunderbird/linux-sys-tray https://github.com/thunderbird/dbus_hooks

Let's see how well this works, it only mentions KDE and Gnome.

Ideally we can scrap the Betterbird implementation at some stage.