Skip to content

windows: TrayIcon SetTooltip + Readd (TaskbarCreated recovery) - #212

Merged
turinglambdaai merged 3 commits into
mainfrom
windows-tray-tooltip-readd
Oct 12, 2026
Merged

turinglambdaai merged 3 commits into
mainfrom
windows-tray-tooltip-readd

Conversation

@turinglambdaai

Copy link
Copy Markdown
Owner

Found migrating movebit's tray to the first-party rivet::system::TrayIcon (the movebit host previously hand-rolled Shell_NotifyIcon; see the family tray-capability issue for the full picture).

Two gaps make the first-party class unusable for state-aware tray apps today:

  1. Tooltip relabeling — a tray tooltip that carries app state (movebit: running/paused + today's active total, refreshed every scheduler tick) forces destroy-and-reallocate of the icon just to change a label. SetTooltip issues the NIM_MODIFY/NIF_TIP update.
  2. Explorer restart — the TaskbarCreated broadcast reaches the host window, but nothing re-registered the icon, so the first Explorer restart under a shipped app silently ate the tray presence. Readd issues the NIM_DELETE+NIM_ADD pair from the stored payload (the callback message is now stored, so the re-registered icon keeps the same activation contract); the host's TaskbarCreated handler is one call. Forwarding is documented on the class — the broadcast reaches the owning HWND, which already must be subclassed to receive callback_message anyway.

No behavior change for existing callers; constructor/destructor contract unchanged. CHANGELOG entry under Unreleased.

Verified against movebit's host build (Racket 9.0 CS, VS 18, WinUI 3 / Windows App SDK 2.4): icon registers, tooltip relabels per tick, and Readd on a manually posted TaskbarCreated restores the icon.

turinglambdaai and others added 3 commits October 12, 2026 19:30
State-aware tray apps (movebit: running/paused + today's totals) currently
have to destroy and re-allocate the icon just to relabel the tooltip, and
lose the icon entirely the first time Explorer restarts under them — the
TaskbarCreated broadcast reaches the host window, but nothing re-registers
the icon.

SetTooltip issues the NIM_MODIFY/NIF_TIP update; Readd issues the
NIM_DELETE + NIM_ADD pair with the stored payload so the host's
TaskbarCreated handler is one call. The callback message is now stored so
Readd re-registers the same activation contract. Hosts forward
TaskbarCreated from their subclass procedure; documented on the class.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant