Tray icon missing when the manager service auto-launches the UI at boot/logon (manual launch works) - v0.10.3
- Dominant language
- Go
- Stars
- 22
- Forks
- 10
- Avg merge
- 1m
- Merged PRs (30d)
- 1
Description
### Describe the bug
After Windows starts, the Pangolin UI process is launched automatically (it is
visible in Task Manager as `Pangolin.exe`), but **no system tray icon appears**
and there is no window. The process just sits there "invisible". If I then start
Pangolin manually (Start menu / exe), the tray icon appears correctly and
everything works.
This looks **distinct from #13** (which was standard-user accounts being
excluded by the `isAdmin/isOperator` check and was fixed in 0.6.0). In my case
the UI process *is* spawned and a manual launch *does* work, so authorization is
fine — this is a **timing/race** problem with the auto-launched instance only.
### Environment
- Pangolin Windows client **0.10.3** (MSI: `pangolin-amd64-0.10.3.msi`)
- Windows 11 Pro 64-bit (build 10.0.26200)
- Per-machine install to `C:\Program Files\Pangolin\`
### Steps to reproduce
1. Install Pangolin and let it run (manager service installed, UI enabled).
2. Reboot / log in.
3. Observe: `Pangolin.exe` is running (Task Manager) but there is **no tray icon
and no window**.
4. Manually launch Pangolin -> tray icon appears and works normally.
### Likely root cause
Inspecting `Pangolin.exe` shows the manager service launches the UI via
`managers.launchUIProcess` using `WTSGetActiveConsoleSessionId` +
`WTSQueryUserToken` + `CreateProcessAsUser`. At boot/logon this runs **before the
shell's notification area is ready**, so the initial `Shell_NotifyIcon(NIM_ADD)`
fails silently while the process keeps running. A later manual launch (shell
already up) succeeds. There is a `UI launch: retry attempt` path, but it is not
sufficient in this scenario.
### Suggested fix
Make the tray UI resilient to being started before the shell:
1. **Handle the `TaskbarCreated` registered window message** and (re-)add the
tray icon when it arrives. This is the canonical Win32 pattern and also fixes
the icon vanishing after an Explorer restart.
2. Optionally, retry `Shell_NotifyIcon(NIM_ADD)` with backoff for longer / until
it succeeds, or wait for `explorer.exe` / the shell window to be present
before the first add.
Contributor guide
Assessment
This issue has not been assessed yet.