After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 786517 - GtkStatusIcon: Provide API to detect whether a status icon can be set
GtkStatusIcon: Provide API to detect whether a status icon can be set
Status: RESOLVED INVALID
Product: gtk+
Classification: Platform
Component: Widget: GtkStatusIcon
3.22.x
Other Linux
: Normal major
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2017-08-19 15:09 UTC by Christian Stadelmann
Modified: 2017-08-19 22:11 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Christian Stadelmann 2017-08-19 15:09:06 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
Comment 1 Jeremy Bicha 2017-08-19 19:37:18 UTC
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?
Comment 2 Christian Stadelmann 2017-08-19 19:42:59 UTC
(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.
Comment 3 Florian Müllner 2017-08-19 22:11:00 UTC
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/