GNOME Bugzilla – Bug 721967
Offer system tray icon
Last modified: 2018-10-28 22:26:17 UTC
As mentioned at bug #714644 (and requested on the mailing list), Geary could offer a system tray icon to make it visible when running in the background. As pointed out on the mailing list, a system tray icon may be useful even if it's not running in the background but merely minimized on a desktop without a prominent dock.
Created attachment 266037 [details] [review] Patch to implement a systray icon
This is a first draft of an implementation of a systray icon. I'd like to get some feedback before I go further, maybe implementing things such as "minimize to tray", "close to tray" or "start minimized".
This looks pretty good for a start. I should mention that I had some trouble with your patch. Are you using git diff to generate it? I was able to massage it to review, but you might in the future verify that your patch applies against master cleanly. Some notes: * In StatusIcon, you have private members declared like this: private Gtk.Menu context_menu { get; private set;} In Vala, these are GObject properties, which is overkill for almost all private data. You can merely use them as private instance variables: private Gtk.Menu context_menu; * quit_menu_item isn't referenced, and so it doesn't need to be declared. Regarding where to go into the future, let's discuss that before you dive in. For example, I don't know what the difference is between "minimize to tray" and "close to tray". "start minimized" would probably only make sense if Geary were launched when the user logs in, and that's a larger task.
Created attachment 266210 [details] [review] Patch to implement a systray icon (2) Here's an updated version of the patch, taking your remarks into account. Those are my very first lines in Vala, so I thought there might be a few adjustments to be made. The difference between "close to tray" and "minimize to tray" is simply the titlebar button used to reduce the window (minimize vs close). The current behavior of geary is for the process to end when closing the window. With the addition of a status icon, I think it would make sense to offer the possibility to keep geary running in the tray when clicking the close button and to only actually close the application when selecting that option in the menu (or from the status icon itself).
Created attachment 266212 [details] [review] Patch to implement a systray icon (3) Sorry, noticed that new patch wasn't properly formatted either, so here's another one. Should be OK this time.
The situation has gotten a bit more complicated. When I first mentioned on the mailing list that I would give your patch full consideration, it was because GtkStatusIcon wasn't marked as deprecated (so much of GTK has been in recent months) and that Transmission uses one. I also found this page: https://wiki.gnome.org/Projects/GnomeShell/Design/Guidelines/MessageTray While all these data points don't add up to a ringing endorsement, it seemed to indicate that guarded use of a status icon was acceptable, and so I was curious what you'd come up with. Well, I was wrong, at least according to the GNOME powers-that-be. On IRC they've made it clear that Geary should not use a status icon at all. However, when it comes to putting Geary into the background, there doesn't appear to be a blessed way of doing so available today. I also discovered these links: https://wiki.gnome.org/Projects/GnomeShell/Design/Guidelines/MessageTray/Compatibility https://trac.transmissionbt.com/ticket/3685 Gwendal, your patch looks fine, but the considerations above means I need to put this on hold. Let me do more thinking, talking, and research, and get back to this. Until then, I've placed it in a branch at wip/721967-status-icon
I understand your points, although I have to admit I'm getting more and more frustrated with GTK. In my opinion, the 2 questions you need to ask yourself are the following : * What are the actual downsides of using a status icon in GNOME, since as I understand it, it won't be displayed anyhow ? * How much importance do you give to having geary running in a friendly manner on other desktops ? I had seen the transmission thread a while ago already, you'll notice it's been 3 years now, and the status icon is still there and as far as I know they have no intention of getting rid of it. With that said, I understand that you want to give this some more thought. Let me know what you decide, I'd be interested in going a bit further if this was to be implemented.
Please do implement this. 'Start Minimized' is not as intuitive as when the user clicks and expect something happens, it just doesn't because it's minimized. 'Minimize to tray' is not as good either because the default Gnome does not provide a minimize icon on the window bar. 'Close to tray' is the best and many other applications such as pidgin are doing in this way.
GNOME apps should not use GtkStatusIcon, nor should they attempt to implement minimize/close to system tray. A GNOME app can run in the background, download email, present a persistent notification when a new email comes in, and launch a window when the notification is clicked. You *should* use GNotification for this; libnotify is also OK. GNOME Software does something similar to this, and it would be cool if Geary did as well. If you want to implement a system tray icon for the benefit of users of other desktops and you're OK with desktop-specific codepaths, you can check XDG_CURRENT_DESKTOP before using GtkStatusIcon. It's a comma-separated list: just make sure that GNOME isn't in the list before displaying the icon. Such status icons are difficult to access and look quite poor in GNOME, and it's possible (though I won't say "likely") that they will not be supported at all in the future. [1] https://developer.gnome.org/GNotification/
You're conflating two issues here: running in the background and notifying users of new mail. Only the former is in question. > A GNOME app can run in the background, download email, present a persistent > notification when a new email comes in, and launch a window when the > notification is clicked. You *should* use GNotification for this; libnotify is > also OK. Geary 0.8 offers this today, although it uses libnotify instead of GNotification. (Id' be happy to move to GNotification, it's just one more item on my to-do list.) That is not the problem behind this ticket. The solution to be solved by a status icon is to (a) allow the user to know the app is indeed running and (b) bring that background app to the fore when the user wants to interact with it. Without a status icon, there's no way to do (b) other than the user "launching" the application. If the app is not in the user's favorites list, they have to search for it in the app list. It's not a great experience. In fact, I would argue it's a worse experience than simply offering a status icon. > If you want to implement a system tray icon for the benefit of users of other > desktops and you're OK with desktop-specific codepaths, you can check > XDG_CURRENT_DESKTOP before using GtkStatusIcon. That's the kind of thing we're considering, although using XDG_CURRENT_DESKTOP is an approach we'd not considered. The fact that GtkStatusIcon is now deprecated doesn't help our situation, though. > Such > status icons are difficult to access and look quite poor in GNOME, Then I would suggest the GNOME Shell team needs to address that rather than command application writers not to use them. > and it's > possible (though I won't say "likely") that they will not be supported at all > in the future. The GNOME team is getting ready to release the 8th version of GNOME Shell and GTK+ since the move to 3. It still doesn't have a solid story for applications that want to run in the background. I've discussed this issue with the powers that be and was told (a) never, ever use a status icon and (b) there were grand plans to handle background applications that, as far as I can tell, haven't moved forward. That's why this ticket remains open.
(In reply to comment #10) > Geary 0.8 offers this today, although it uses libnotify instead of > GNotification. (Id' be happy to move to GNotification, it's just one more item > on my to-do list.) That is not the problem behind this ticket. I think the difference is that, unless I'm mistaken, Geary currently only downloads mail if one window is visible. Ideally the mail client would run in the background and download mail regardless of whether it currently has a window visible. > Then I would suggest the GNOME Shell team needs to address that rather than > command application writers not to use them. I agree with you here: these should either work well (i.e. not be effectively ugly persistent notifications), or else not be supported at all. > The GNOME team is getting ready to release the 8th version of GNOME Shell and > GTK+ since the move to 3. It still doesn't have a solid story for applications > that want to run in the background. I've discussed this issue with the powers > that be and was told (a) never, ever use a status icon and (b) there were grand > plans to handle background applications that, as far as I can tell, haven't > moved forward. That's why this ticket remains open. So I found the tentative designs: https://wiki.gnome.org/Design/Whiteboards/BackgroundApps You can leave comments at the bottom of that page if you want. It looks like there is a desire to do something similar to what you want, but I see more questions than answers there now. I doubt it will be a traditional systray icon, or that anything will be implemented in the near future, but could be wrong. Sorry if my first post came across as rude. Happy new year!
(In reply to comment #11) > I think the difference is that, unless I'm mistaken, Geary currently only > downloads mail if one window is visible. Geary can be configured to run in the background. When set, it will launch at login. No window is visible but mail is downloaded and notifications are made. This isn't the default configuration, it must be enabled in Preferences. > So I found the tentative designs: > https://wiki.gnome.org/Design/Whiteboards/BackgroundApps Thanks for the tip, I wasn't aware of that page. > Sorry if my first post came across as rude. And I apologize if I came across brusquely. Cheers!
You didn't, but one note: when I read "notify of new mail at startup" I thought "I don't want notifications of new mail when I start Geary, since I started it to look at my mail, so I'll leave this unchecked" -- I had no inkling that this would run Geary in the background. So that could stand to be rephrased somehow.
We went around a few times trying to come up with something less technical than "Run Geary in the background". The problem we were attempting to solve was people wanted to be notified of new email all the time, not just when Geary was running, and that's how we came up with it. Suggestions are welcome. I've opened a ticket: bug #742244.
*** Bug 748471 has been marked as a duplicate of this bug. ***
This is a very disappointing situation. The lack of a status icon is a deal breaker for me, and surely that will be the case for most non-Gnome Shell users. KDocker offers a half-baked workaround, but the rough edges that result from a lack of native support leave plenty to be desired. For something I use all day, every day, I need to go elsewhere.
Given that GtkStatusIcon is deprecated, the best approach to solving this is likely going to be if someone steps up and writes a standalone system tray icon app, much like the one that Network Manager has. That way people using non-GNOME DE's can simply install that and go. This may require adding some infrastructure such as additional DBus properties/methods to Geary, but I'd be more than happy to support that.
This would be an ideal candidate for a plugin if we had support for plugins - e.g. Bug 714883.
*** Bug 795541 has been marked as a duplicate of this bug. ***
I created a (pathetically simple) [shell extension](https://github.com/TheBigFatTony/gnome-shell-extension-geary-tray-icon). If you click on the geary icon, it will run the command "geary", bringing the window to the foreground. It would be nice to minimize Geary if the window is already up but I don't know how to do this in a way that also works on Wayland. The simplest solution might be to add a new option: "geary --toggle" which does the following: 1) if geary isn't running: start geary 2) if geary is in the background: close window 3) if geary is in the foreground: open window
Hey, thanks for putting that together. I'm wondering if any window managers support minimising application windows, perhaps by D-Bus?
No worries. :) The window managers aren't the problem, I think. In a way, they are already able to do what I want: If I close the window, the GUI disappears but the daemon continues running in the background. I simply want a command-line way for Geary to do just that. I just read https://bugzilla.gnome.org/show_bug.cgi?id=775956#c1 but I didn't quite understand it. Maybe it is already possible by passing some sort of "quit argument" via the command line? Maybe, a new "gapplication action" could be added?
I just wrote up a tracking bug for the plugin system over at gitlab that collects all of the requirements for feature requests that should be implemented as plugins in the one place, so closing this bug in favour of that ticket: https://gitlab.gnome.org/GNOME/geary/issues/155