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

Activation via system tray click for older systrays like trayer #208

Closed Betterbird closed 11 months ago

Betterbird commented 11 months ago

In https://github.com/AyatanaIndicators/libayatana-appindicator/pull/71#issuecomment-1741638469 it was suggested to add this code:

 static void
 status_icon_activate (GtkStatusIcon * icon, gpointer data)
 {
+    AppIndicator *app = APP_INDICATOR(data);
+    g_signal_emit(app, signals[ACTIVATE_EVENT], 0, 0, 0);
+
     GtkMenu * menu = app_indicator_get_menu(APP_INDICATOR(data));
     if (menu == NULL)
         return;

Let's see what blows up when we do.

Betterbird commented 11 months ago

Build with this patch: www.betterbird.eu/downloads2/betterbird-115.3.1.en-US-bb14-additional-activation.linux-x86_64.tar.bz2

@Narthorn: No need for you to try this build since it should be the same you compiled yourself. @dark-penguin, @Zahrun, @felixoi: could you please check the build to confirm that nothing broke? I didn't see a change in behaviour on Xfce.

activation.patch

dark-penguin commented 11 months ago

You are not supposed to see a change - as I understand, this fixes the non-SNI behaviour.

On Mate, what blows up is it no longer processes tray icon clicks with my enable-sni-support fix (why?? Does this inadvertently modify the old behaviour?). However, it does process clicks without that fix - both left-clicking and right-clicking the icon restore the window!

Betterbird commented 11 months ago

So we go with this fix and remove the gsettings set org.mate.panel enable-sni-support true from the documentation?

dark-penguin commented 11 months ago

Yes!

Oh, by the way, SNI support being broken is a user error on my part - it works just fine too. I've simply found another bug, and got confused.

(EDIT: The bug I've encountered is a Thunderbird bug - it's reproducible in Thinderbird 115.3.1 . If you disable your Internet connection and start Thunderbird, then immediately close it while it's trying to get mail, then the Thunderbird process will hang and never die. With Betterbird, this can be confused with a tray icon "not working again", because the icon does not disappear until the process dies. So if you forget that you've closed the window instead of minimizing it, then you'll see an unresponsive icon, and you'll blame the tray icon for not working again.)

dark-penguin commented 11 months ago

We can also add MATE tray icon support by default now if we haven't yet. It is now just as first-class as everything else.

Betterbird commented 11 months ago

Well, let's have the KDE and Gnome people check it first. Maybe it even works on Cinnamon now. Also, I'd need to ship the new version first.

dark-penguin commented 11 months ago

I did the testing - I was curious about Cinnamon, for which we don't have a "designated tester", and I already have a KDE machine ready.

On KDE, clicking the icon works the same as before. On Cinnamon... it seems to behave the same as before: clicking the icon shows a tiny empty menu. Does not do anything about the window.

I actually don't understand what that code with an empty menu is doing. Is it a workaround for something?

Also, I believe it would be closer to "proper code" if it was either

  AppIndicator *app = APP_INDICATOR(data);
  g_signal_emit(app, signals[ACTIVATE_EVENT], 0, 0, 0);

- GtkMenu * menu = app_indicator_get_menu(APP_INDICATOR(data));
+ GtkMenu * menu = app_indicator_get_menu(app);

or

- AppIndicator *app = APP_INDICATOR(data);
- g_signal_emit(app, signals[ACTIVATE_EVENT], 0, 0, 0);
  g_signal_emit(APP_INDICATOR(data), signals[ACTIVATE_EVENT], 0, 0, 0);

  GtkMenu * menu = app_indicator_get_menu(APP_INDICATOR(data));

although I don't know enough to be sure I'm not missing anything and the second part would even work.

Betterbird commented 11 months ago

Huh? Look at the patch:

 static void
 status_icon_activate (GtkStatusIcon * icon, gpointer data)
 {
+    g_signal_emit(APP_INDICATOR(data), signals[ACTIVATE_EVENT], 0, 0, 0);
     GtkMenu * menu = app_indicator_get_menu(APP_INDICATOR(data));
     if (menu == NULL)
         return;

which is your "second part". APP_INDICATOR(data) is just a cast or some accessor.

dark-penguin commented 11 months ago

Oh, I did not look at the actual patch - I've only seen the proposed one. So yeah, you've already done that. :)

Betterbird commented 11 months ago

So this one is done.

felixoi commented 11 months ago

You tested GNOME already, right? Was not available the last days, sorry. The download link is not available anymore.

Betterbird commented 11 months ago

They moved: https://github.com/Betterbird/thunderbird-patches/issues/209#issuecomment-1742174820, three versions to test including the official release.