On Linux, cc-switch currently builds its tray icon with TrayIconBuilder::with_id("main").
That becomes a problem when another Tauri app does the same thing. The tray-icon crate uses the tray id to derive both the AppIndicator identifier and the temporary PNG path under $XDG_RUNTIME_DIR/tray-icon, so two apps using the same id end up sharing the same runtime resources.
Concrete example:
cc-switch uses with_id("main")
clash-verge-rev also uses with_id("main")
cc-switch starts first and exposes /run/user/$UID/tray-icon/tray-icon-main-0.png
- Starting
clash-verge-rev creates the same tray-icon-main-0.png, then updates its icon to tray-icon-main-1.png / tray-icon-main-3.png
- During that update,
tray-icon deletes the previously active tray-icon-main-0.png
- GNOME AppIndicator then tries to refresh
cc-switch using the stale path and the icon disappears or falls back to an error/placeholder icon
This is not specific to Clash Verge Rev; that app is just an easy reproducer because it also uses Tauri + tray-icon and also uses "main" as the tray id.
Suggested fix:
- use an app-specific tray id such as
"cc-switch"
- update internal
tray_by_id("main") call sites to use the same app-specific tray id constant
I have a small PR ready that does exactly that.
On Linux,
cc-switchcurrently builds its tray icon withTrayIconBuilder::with_id("main").That becomes a problem when another Tauri app does the same thing. The
tray-iconcrate uses the tray id to derive both the AppIndicator identifier and the temporary PNG path under$XDG_RUNTIME_DIR/tray-icon, so two apps using the same id end up sharing the same runtime resources.Concrete example:
cc-switchuseswith_id("main")clash-verge-revalso useswith_id("main")cc-switchstarts first and exposes/run/user/$UID/tray-icon/tray-icon-main-0.pngclash-verge-revcreates the sametray-icon-main-0.png, then updates its icon totray-icon-main-1.png/tray-icon-main-3.pngtray-icondeletes the previously activetray-icon-main-0.pngcc-switchusing the stale path and the icon disappears or falls back to an error/placeholder iconThis is not specific to Clash Verge Rev; that app is just an easy reproducer because it also uses Tauri +
tray-iconand also uses"main"as the tray id.Suggested fix:
"cc-switch"tray_by_id("main")call sites to use the same app-specific tray id constantI have a small PR ready that does exactly that.