Skip to content

fix: Preserve tray tooltip when showing notifications#239

Merged
HavenDV merged 1 commit into
HavenDV:masterfrom
danielchalmers:fix-preserve-tooltip-on-notification
May 15, 2026
Merged

fix: Preserve tray tooltip when showing notifications#239
HavenDV merged 1 commit into
HavenDV:masterfrom
danielchalmers:fix-preserve-tooltip-on-notification

Conversation

@danielchalmers
Copy link
Copy Markdown
Contributor

Fixes a regression where setting ToolTipText before ForceCreate() can be lost as the visible hover tooltip if ShowNotification(...) is called immediately after the tray icon is created.

Repro

_trayIcon = (TaskbarIcon)resources["TrayIcon"];
_trayIcon.ToolTipText = "Test";
_trayIcon.ForceCreate();
_trayIcon.ShowNotification("Test", "This stops the tooltip from showing");

Then try hovering the tray icon.

Codex explanation

The tooltip is assigned before ForceCreate(), and Create() sends it to Shell_NotifyIcon with NIF_TIP. The problem is the immediately following notification update: ShowNotification(...) sends another NIM_MODIFY with NIF_INFO, but previously did not include the current tooltip fields. Explorer can then stop showing the hover tooltip until the tooltip is written again.

This change preserves the current tooltip state during the notification modify call by sending the cached tooltip text with NIF_TIP, and carrying NIF_SHOWTIP when UseStandardTooltip is enabled.

Include the current tooltip fields in the same NIM_MODIFY call that displays a native balloon notification. Explorer can otherwise treat an immediate post-create NIF_INFO update as replacing the newly-added icon state and stop showing the hover tooltip until the tooltip is written again.

This keeps the existing UseStandardTooltip behavior by carrying NIF_SHOWTIP through notification updates, and sends NIF_TIP with the current cached tooltip text for both 32-bit and 64-bit NOTIFYICONDATA paths. No public API surface changes.
@danielchalmers danielchalmers changed the title Preserve tray tooltip when showing notifications fix: Preserve tray tooltip when showing notifications May 15, 2026
@HavenDV HavenDV merged commit 2d1d29b into HavenDV:master May 15, 2026
2 of 3 checks passed
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.

2 participants