Permissions for showing tray icon

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:

  1. I need a --talk-name=org.kde.StatusNotifierWatcher permission
  2. I need a –filesystem=/run/user permission ??

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.

Let me guess, it’s Tauri v2? The default tray icon path Tauri uses is not suitable for sandboxed apps. You need --filesystem=xdg-run/tray-icon:create for it.

It also has the APIs to use a different path, so you can choose something more sandbox friendly like XDG_CACHE_HOME.

Yes, it’s tauri v2.

Just what I was looking for.

Yup, found it now. It’s a good idea to set a custom path because tauri tray-icon crate has a bug where different tauri apps will overwrite each other’s icon files if launched simultaneously :expressionless:

Thanks for the help!

This topic was automatically closed after 4 days. New replies are no longer allowed.