Skip to content

[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

Closed

Description

@Jensenwgd

Environment

  • OS: Windows 11 (build 26100.x)
  • WG Tunnel Desktop 2.4.1
  • Daemon installed as Windows service (wgtunnel-daemon, SYSTEM, Auto)

Settings

  • "Restore auto-tunnel at login" enabled

Reproduce

  1. Settings -> Startup -> enable "Restore auto-tunnel at login"
  2. Connect the tunnel, confirm it's up (blue dot shows)
  3. Reboot the machine
  4. After Windows login, the GUI starts quietly in the system tray (main window hidden)
  5. 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):
    LaunchedEffect(currentTunnelStatus, currentTunnelTooltipMessage, uiState.lockdownActive) {
        trayBadgeState = when { ... }
    }
    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

  1. added a commit that references this issue on Nov 23, 2026
    83a4645
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions