Repository navigation
Linux: system tray and minimize to tray via ksni - #187
Merged
Merged
Conversation
Use ksni (pure Rust DBus StatusNotifierItem) instead of the tray-icon crate on Linux, since the latter requires a GTK event loop that conflicts with libcosmic. Window close now hides the application instead of exiting, so streaming continues in the background. Reopens via tray menu or launching a second instance.
The connect/disconnect menu items were inverted: two negations canceled out, so connect stayed enabled while connected. These are now driven by the same disconnected flag passed to update_menu_state. Previously, the start minimized setting required being launched automatically, which never happens on Linux since there is no autostart implementation, so the setting never applied. Now, on Linux, the setting always applies.
Owner
|
Thank you for the PR! |
ID-VerNe
pushed a commit
to ID-VerNe/AndroidMic
that referenced
this pull request
Nov 16, 2026
Linux: system tray and minimize to tray via ksni
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This adds a system tray and "minimize to tray" behavior on Linux, which was previously disabled.
Commit
66be82e("exclude system tray for Linux") disabled the tray on Linux because thetray-iconcrate requires a GTK/libappindicator event loop, which conflicts with the cosmic/iced event loop. That also meant closing the window quit the app entirely, and thestart_minimizedsetting did nothing on Linux.Approach
Instead of re-enabling
tray-iconon Linux, this PR adds a second Linux-only backend for the tray using ksni (a pure Rust implementation of the freedesktop/KDE StatusNotifierItem specification):tokiofeature, and there is no zbus feature-mixing risk sincenotify-rustuses zbus 3.x whileksniuses zbus 5.x, which are separate crates).SystemTray::new,update_menu_state,SystemTrayStream::sub) is unchanged, soapp.rsmostly drops#[cfg(not(target_os = "linux"))]gates.Behavior changes on Linux
Start minimizedsetting now works on Linux: on this platform the app has no "launched automatically" code path (the Linux version ofstart_at_loginis an unimplementedtodo!()), so the setting previously could never apply. It is now honored unconditionally.disconnectedflag and the menu enable states), soConnectstayed enabled while already connected.Caveats
Notes