Solaar tray-icon does not show + possible-fix
Created by: jwrdegoede
While working on making the TopIcons GNOME extension, which is necessary to get tray-icons to work with GNOME3 run with GNOME40, I noticed that the solaar tray-icon only shows when running GNOME40 on Xorg and not when running GNOME40 as Wayland compositor.
This is caused by Solaar being GTK based and GTK using the Wayland backend when running under Wayland, which is all good, except that Wayland does not have anything like tray-icons, so the GTK tray-icon code is just stubs when running under Wayland.
I've tried and this can be worked around by forcing the use of the X11 GTK backend, and thus use Xwayland at which point the tray-icon compat stuff in GNOME40 happily picks up the tray-icon.
Specifically I tried killing the running solaar process and started it manually like this: GDK_BACKEND=x11 solaar --window=hide
Forcing use of the x11 backend can be also done from within the code itself by calling gdk_set_allowed_backends() (or the PyGTK equivalent).
Note I'm not sure if this is the best solution, that depends on how much being native-wayland is valued over how much having the tray-icon is valued. One thing to keep in mind here is that at least under GNOME3 tray-icons won't be visible by default (they require installing an extension).
Alternatively an option would be to add some check to: /etc/xdg/autostart/solaar.desktop
To have it not run when running under Wayland, because to me it seems that the primary purpose of having solaar autostart is showing the trayicon.
Maybe instead of --window=hide have a --tray-icon option for the /etc/xdg/autostart/solaar.desktop file and then check if the trayicon functionality is available and if it is not available then just exit. This would also work for when the TopIcon extension is not installed in GNOME3 independent of the windowing-system, because then the trayicon availability check in GTK will report that the trayicon functionality is not available.