I have an app that uses a tray icon (appindicator). When I build it into a flatpak the tray icon gets created but it’s invisible. On kde plasma it is just empty space in the taskbar that I can click and get a menu out of, on cinnamon desktop there is a similar small slice of space but no visible icon.
I did a lot of investigations with dbus-monitor, trial and error with various bus and system permissions and found that:
- I need a
--talk-name=org.kde.StatusNotifierWatcherpermission - I need a
–filesystem=/run/userpermission ??
While first one is understandable and I see it in lots of other apps with tray icons on flathub, I don’t understand why second one is needed.
Here is how I figured out that I need /run/user access: through dbus monitor I noticed that path to the icon file gets passed around and it is /run/user/1000/tray-icon/tray-icon-2-0.png
If I run my app natively, surely enough an icon file appears at that path when the app creates a tray icon. But without the /run/user permission flatpak does not create the same file and I figured that is why icon is missing from the tray, even though the menu is there.
What I am unsure about is if there is more correct approach to allow flatpak app to write to $XDG_RUNTIME_DIR/tray-icon so that host can see it and display in the tray applet.
The behavior I’m describing is same for both libappindicator or libayatana-appindicator from flatpak shared modules. I’m seeing it on stock debian trixie with both cinnamon and kde plasma, either x11 or wayland sessions.
For context my app is GitHub - flathub/org.openscopeproject.TrguiNG and is already published but last released version uses some different method of displaying the tray icon which does not rely on writing files to runtime dir. I can not easily switch back to old method because it is done by the framework I’m using which I’m forced to update to be compatible with new platforms.