Replies: 1 comment
|
I'll take a PR but I don't plan on working on this myself. I think we should wait only for a specific amount of time though, not indefinitely. |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Summary
On Linux, Sunshine checks for a system tray exactly once at startup. If the tray host (StatusNotifierWatcher) isn't up yet at that moment, the tray is never created for the rest of the run, even after the tray host appears a few seconds later. Windows already handles this case by waiting for the shell before registering the tray icon. I'd like Linux to do the same.
Use case
I run Sunshine as a systemd user service on a GNOME (Wayland) desktop with GDM auto-login. The session locks itself immediately, and I unlock it remotely through Moonlight after Wake-on-LAN.
GNOME disables all shell extensions while the session is locked, including AppIndicator support, which provides the StatusNotifierWatcher. So when Sunshine starts:
System tray is not initializedand runs without a tray;Other tray apps that start at the same time recover on their own. Steam and Blueman, both libappindicator-based, register their icons once the watcher appears after unlock.
The same race likely affects any setup where Sunshine's user service starts before the panel or tray host is ready: shell extensions loading late, other desktops' startup order, and so on.
Where it happens (2026.914.233613)
src/main.cpp: on non-Windows,system_tray::init_tray()is called once, synchronously, beforemainThreadLoop().third-party/tray/src/QtTrayMenu.cpp,QtTrayMenu::init():src/system_tray.cpp,init_tray_with_stop_token():As far as I can tell, simply skipping the
isSystemTrayAvailable()check wouldn't be enough, since Qt seems to pick its D-Bus tray backend only when the icon is created. The icon probably needs to be created after the watcher is available.Possible approach
On Linux, when the tray isn't available at startup, don't give up. Instead:
isSystemTrayAvailable()(for example, every few seconds, stopping on shutdown) and initialize the tray once it returns true; ororg.kde.StatusNotifierWatcherappearing on the session bus (for example, withQDBusServiceWatcher) and initialize the tray then.Either way, streaming and the web UI should keep running while it waits. SunshineStream/Sunshine#5968 already makes Sunshine continue without a tray, so this would build on that by attaching the tray once it becomes available.
Environment
WantedBy=graphical-session.target), KMS captureCurrent workaround
system_tray = disabled, which stops it from trying. The web UI covers everything the tray menu offers, but the pairing notification and the quick links are lost.All reactions