XAppStatusIcon is an alternative to Gtk.StatusIcon and AppIndicator.
Gtk.StatusIcon features the following limitations:
It's not future-proof (it won't work in Wayland, it won't be in GTK4 etc..)
It's not supported in KDE (we currently use AppIndicators there)
It's a widget which is rendered by the app and cropped/warped into the applet via Gtk.Plug/Socket... this is extremely buggy in Cinnamon and GNOME and creates all sorts of issues (16px icons, HiDPI blurriness, rendering issues)..
AppIndicator solves some of these issues by delegating the rendering of the icon to the applet directly. The AppIndicator simply sends data info over DBUS and all is rendered on the other side natively by the applet. This solves HiDPI and rendering issues but the AppIndicator library has other limitations:
It doesn't provide some of the necessary features present in Gtk.StatusIcon (for instance, you can't Activate an app, or show its window by clicking its indicator)
It doesn't let the app render its context menu. Although that could be considered a good thing (the menu is passed over dbus via dbusmenu and rendered natively by the applet), it limits what an app can do with its context menu. A sound applet for instance couldn't implement multimedia butons and a layout it could handle in GTK using Gtk.StatusIcon.
The idea behind XAppStatusIcon is to replace usage of Gtk.StatusIcon and AppIndicator so applets can render status icons natively (icon, label, tooltip) but let apps handle the context menu.
When a status icon is clicked, the event info is passed over dbus back to the app.
Last but not least, XAppStatusIcon checks for the presence of a running applet. If no applet is found, it falls back to a Gtk.StatusIcon and delegates to it. In other words, apps can use XAppStatusIcon, whether or not an applet is present to render it. If it's the case, the icon will be rendered natively by the applet, otherwise a Gtk.StatusIcon will be used as fallback. Apps don't need to worry about it.
An example of an app using an XAppStatusIcon, written in python, is available in test-scripts/xapp-status-icon.
An example of an applet, written in python/GTK, is available in test-scripts/xapp-status-applet.
Issues related to the Cinnamon applet:
[x] The context menu is slightly to the right (it's aligned with the mouse pointer, it should be aligned with the status icon instead)
[x] Tooltips shouldn't be shown after a click event.
[x] spacing between icon and label should be reviewed for various cases (for instance when both are defined, or when only one of them or none of them are defined).
[x] Should the icon take into account the panel settings for symbolic icons when its icon name is *-symbolic?
[x] panel size change, icon theme change, panel orientation change should be supported.
Potential future improvements
[ ] The signals for XAppStatusIcon are not documented in devhelp
[ ] The API should support scrolling the statusIcon
[ ] MATE and Xfce don't have an applet for this yet
[ ] To support KDE out of the box, XappStatusIcon could fallback to AppIndicator instead of Gtk.StatusIcon when XDG_CURRENT_ENVIRONMENT is "KDE".
[ ] The code could be simplified using dbus-codegen
[ ] New classes could be added to simplify writing applets
[ ] StatusIcon.name could be used to order icons within the applet, so that app icons always appear in the same order (not randomly like in the current systray).
[ ] The applet functionality could be merged into systray@cinnamon.org. As it is, people upgrading from older cinnamon versions and which enabled-applets setting was customized, will not be running the new applet by default.
XAppStatusIcon is an alternative to Gtk.StatusIcon and AppIndicator.
Gtk.StatusIcon features the following limitations:
AppIndicator solves some of these issues by delegating the rendering of the icon to the applet directly. The AppIndicator simply sends data info over DBUS and all is rendered on the other side natively by the applet. This solves HiDPI and rendering issues but the AppIndicator library has other limitations:
The idea behind XAppStatusIcon is to replace usage of Gtk.StatusIcon and AppIndicator so applets can render status icons natively (icon, label, tooltip) but let apps handle the context menu.
When a status icon is clicked, the event info is passed over dbus back to the app.
Last but not least, XAppStatusIcon checks for the presence of a running applet. If no applet is found, it falls back to a Gtk.StatusIcon and delegates to it. In other words, apps can use XAppStatusIcon, whether or not an applet is present to render it. If it's the case, the icon will be rendered natively by the applet, otherwise a Gtk.StatusIcon will be used as fallback. Apps don't need to worry about it.
An example of an app using an XAppStatusIcon, written in python, is available in test-scripts/xapp-status-icon.
An example of an applet, written in python/GTK, is available in test-scripts/xapp-status-applet.
Issues related to the Cinnamon applet:
Potential future improvements