StatusIcon has been removed in gtk4, what should I use instead?
Tray icons are X11 only, and have no replacement.
You can keep your application running even if the last window was closed, and if a user launches the application again from the grid or the dash, you can create a new window without having to restart the whole application.
You should use notifications to communicate state changes with the user, especially if the application does not have key focus.
If you do not care about being supported in Gnome Shell by default, on Linux you can use libappindicator which is supported on Wayland. For Gnome Shell the user unfortunately needs to install an extension for it to work however: AppIndicator and KStatusNotifierItem Support - GNOME Shell Extensions
For other wayland desktops such as KDE, Cinnamon and Sway it works out of the box.
Unfortunately libappindicator is Linux specific, so you have to make one implementation for each platform (windows, mac, linux).
The status of tray icon support is currently incredibly messy on Linux, there is an X implementation, libappindicator/KStatusNotifier, XAppStatusIcon (made by the Linux Mint guys), AyatanaIndicator etc…
I can understand that the GTK devs wanted to avoid that mess, especially when GNOME itself don’t think that tray icons are a good idea in the first place.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.