You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[BUG] Windows: tray icon connection badge (blue dot) missing after login-startup with "Restore auto-tunnel at login" enabled; appears only after opening the main window #121
Daemon installed as Windows service (wgtunnel-daemon, SYSTEM, Auto)
Settings
"Restore auto-tunnel at login" enabled
Reproduce
Settings -> Startup -> enable "Restore auto-tunnel at login"
Connect the tunnel, confirm it's up (blue dot shows)
Reboot the machine
After Windows login, the GUI starts quietly in the system tray (main window hidden)
Observe the tray icon
Expected
Tray icon shows the blue connected badge, because the daemon restored the tunnel at boot and auto-tunnel is active.
Actual
Tray icon shows no badge (gray base icon only). The tunnel is genuinely connected. Without manual intervention (opening the main window), the badge never appears. Double-clicking the tray icon to open the main window makes the blue dot appear instantly.
Code analysis
Daemon (wgtunnel-daemon, SYSTEM) starts at boot, brings up the tunnel, and holds the ground truth.
On login, the GUI starts with isMainWindowVisible = !wasStartedAtLogin (Main.kt:210), so the window is hidden and only the Tray{} composable is active.
The tray badge is driven by a LaunchedEffect inside the window content lambda (Main.kt:456-473):
currentTunnelStatus is a derivedStateOf over uiState.tunnelStatuses, which comes from AppViewModel -> BackendService.statusFlow() (client/service/BackendService.kt).
Both the AppViewModel subscription and the badge-writing LaunchedEffect live inside the window content. If a visible=false Nucleus/Tao window does not compose its content on Windows, the Flow subscription never starts and the badge is never written - even though the daemon has been pushing status frames all along.
Opening the main window forces composition -> subscription connects -> first frame arrives -> LaunchedEffect fires -> badge renders.
This is not a missed first frame - the badge stays permanently disconnected from actual tunnel state. Since the subscription never starts, subsequent state changes (tunnel drop, auto-recovery, handshake failure) also never reach the tray icon. The badge is a dead indicator until the window is manually opened at least once.
Note: The same startup path (wasStartedAtLogin -> hidden window -> restore logic inside window content) is shared by all three "Startup" radio options (Launch at login / Restore tunnel at login / Restore auto-tunnel at login). From code inspection, all three should exhibit the same missing-badge behavior.
Suggested fix
Lift the status subscription and trayBadgeState write out of the window content into the nucleusApplication root scope (where Tray{} already lives). The window keeps reading shared state; the write side must not depend on a hidden window's composition.
Activity
fix: additional tray tunnel status fixes and restore at login