Repository navigation
Description
What happens
On BaoCode 2.0.1+34 (Windows x64), the tray icon never shows up. Clicking the window's X hides the window (closeRequested → hide in events.log) and the process keeps running, but there is no BaoCode icon in the notification area nor in the "Show hidden icons" overflow. The only way back is to launch baocode.exe again (the single-instance reopen path).
This started after updating from 1.9.x to 2.0.1 (installed 2026-11-18 09:12 local time).
Environment
- BaoCode 2.0.1+34
- Windows as reported by BaoCode's own log:
"Windows 10 Home China" 10.0 (Build 26300)x64 - Not elevated (
TokenIsElevated = 0), so this is not the admin/Explorer mismatch mentioned in [bug]托盘图标无故消失;终端跑程序会导致ssh没反应(此情况在cursor是正常的) #860.
Settings (not the cause)
%APPDATA%\baocode\User\settings.json contains no tray.enabled key, so the default (true, see AttentionSettings) applies — the user never turned the icon off. Windows' own "Other system tray icons" entry for BaoCode is also on.
Evidence
events.log— close hides, and the window only comes back through a second launch:
2026-11-18T10:48:29.609649 [window] <- closeRequested 0
2026-11-18T10:48:29.612647 [window] -> hide 0
2026-11-18T10:48:35.439816 [window] <- reopen
...
2026-11-18T12:11:07.262490 [window] <- closeRequested 0
2026-11-18T12:11:07.264493 [window] -> hide 0
-
While the window was hidden, UI Automation enumeration of
Shell_TrayWnd(visible area) and ofTopLevelWindowForOverflowXamlIsland(the "Show hidden icons" flyout) returned 14 tray icons; none of them is BaoCode. -
Shell_NotifyIconGetRect({ hWnd = <BaoCode Flutter window>, uID = 1 })returns0x80004005(E_FAIL) for both of the app's Flutter windows — no icon is registered for this run. -
Windows still has a stale notification-icon registration for the executable:
HKCU\Control Panel\NotifyIconSettings\6072978505427888638
UID=1
InitialTooltip=BaoCode
IsPromoted=1
So an earlier run did register the icon, but the current run does not add it.
Reading the code
The 15-second watchdog added in #958 should re-add the icon whenever IconThere() is false, and Shell_NotifyIconGetRect says it is false — so either the timer is not firing in 2.0.1, or NIM_ADD keeps failing silently.
Related: WM_CLOSE in attention.cpp hides the window whenever tray_ is set, even if icon_added_ is false. That is what leaves the app unreachable instead of falling through to a quit.
Workaround
Relaunching baocode.exe brings the hidden window back. Toggling Settings → Notifications → Tray off/on recreates the icon for some users (the workaround in #860).
Happy to supply more logs or test a build.
Activity
fix(windows): closing the window without a tray icon minimizes it (#1291
leookun commentedon Nov 24, 2026
Thanks for the thorough investigation. #1291 is a first step:
events.logas[tray] icon not added: error N.The root cause isn't known yet, so I'm leaving this open. After the next release, if the icon is still missing, could you post that
[tray]line from events.log?