GNOME Bugzilla – Bug 786517
GtkStatusIcon: Provide API to detect whether a status icon can be set
Last modified: 2017-08-19 22:11:00 UTC
It looks like GtkStatusIcon support is going away in gnome-shell: https://bugzilla.gnome.org/show_bug.cgi?id=721596#c72 In the transition of removing support for GtkStatusIcon, it would be nice to have an API to detect whether a GtkStatusIcon can be shown. Current behavior: Creating a GtkStatusIcon fails silently, which breaks some applications without any hint on what is wrong, for neither user nor developer. Expected behavior: Either creating the GtkStatusIcon should fail (e.g. making gtk_status_icon_new() return NULL) or maybe fix gboolean gtk_status_icon_get_visible () gboolean gtk_status_icon_is_embedded () to reflect the real visibility status of the GtkStatusIcon. Gtk version: 3.22.18
As a counterargument, someone pointed that even in GNOME2 days, it was easily possible to run GNOME with no status tray so it's a bit unclear how this would work. Maybe you could just query if GNOME Shell 3.26 or higher is the active desktop?
(In reply to Jeremy Bicha from comment #1) > As a counterargument, someone pointed that even in GNOME2 days, it was > easily possible to run GNOME with no status tray so it's a bit unclear how > this would work. Meaning: ”Relying on GtkStatusIcon to work was always wrong“? In this case, quite many applications are broken out there… > Maybe you could just query if GNOME Shell 3.26 or higher is the active > desktop? How do I do that? Checking `$ gnome-shell --version` and `env | grep DESKTOP_SESSION` to be "gnome" or `env | grep XDG_CURRENT_DESKTOP` to be "GNOME" is ok, but seems rather error-prone to me.
The :embedded property should already work as expected. For what it's worth, after adjusting the topIcon extension[0] (and a minor gnome-shell fix in bug 786526), GTK+'s status icon test reports the correct embedded state. (In reply to Jeremy Bicha from comment #1) > Maybe you could just query if GNOME Shell 3.26 or higher is the active > desktop? That means that status icons won't work for users who want them and install the topIcons extension. That's not really better than assuming the tray exists in previous versions, and break for users who install an extension to remove it[1]. So I agree with Christian, if an application still wants to offer users a status icon, it should check whether it is shown instead of assuming that they will or won't be shown. [0] https://gist.github.com/fmuellner/e1aaec3169990fa7b7bd95da4e0a915a [1] https://extensions.gnome.org/extension/967/hide-legacy-tray/