Explorer.exe reset/restart causes WT tray icon to disappear for the current instance #22403

Closed
opened 2026-01-31 08:12:15 +00:00 by claunia · 1 comment
Owner

Originally created by @Hlsgs on GitHub (Oct 15, 2024).

Windows Terminal version

1.21.2701.0 (and all previous builds, this is not a new issue)

Windows build number

Both W10 and W11 regardless of build number

Other Software

No response

Steps to reproduce

  1. Run WT with hide in notification area when minimized and always display in notification area enabled(the latter is optional)
  2. Use task manager to restart explorer.exe

Expected Behavior

The tray icon should reappear after the reset

Actual Behavior

The tray icon does not reappear after the reset. Only way to get it back is to completly close WT and start it again. This also has some (very) undesirable side-effects such as losing access to the stuff you have currently running(akin to https://github.com/microsoft/terminal/issues/16755 ?). One would obviously not restart explorer.exe out of the blue but it does sometimes crash/restart on it's own, which has the same effect.

Originally created by @Hlsgs on GitHub (Oct 15, 2024). ### Windows Terminal version 1.21.2701.0 (and all previous builds, this is not a new issue) ### Windows build number Both W10 and W11 regardless of build number ### Other Software _No response_ ### Steps to reproduce 1. Run WT with `hide in notification area when minimized` and `always display in notification area` enabled(the latter is optional) 2. Use task manager to restart `explorer.exe` ### Expected Behavior The tray icon should reappear after the reset ### Actual Behavior The tray icon does not reappear after the reset. Only way to get it back is to completly close WT and start it again. This also has some (very) undesirable side-effects such as losing access to the stuff you have currently running(akin to https://github.com/microsoft/terminal/issues/16755 ?). One would obviously not restart explorer.exe out of the blue but it does sometimes crash/restart on it's own, which has the same effect.
Author
Owner

@Zeroes1 commented on GitHub (Oct 15, 2024):

@DHowett I check latest canary build terminal-1.23.2852.0, also latest preview terminal-1.22.2702.0
check on Windows 10.0.19045.5011 (22H2)
[TEST: pskill64.exe explorer.exe and after manually ran again explorer.exe]
and confirm that it does not work - there is no re-registration of the icon in fact...

Strange situation i see what code exist for this, but don't work...

\src\cascadia\WindowsTerminal\WindowEmperor.cpp 
static const UINT WM_TASKBARCREATED = []() { return RegisterWindowMessageW(L"TaskbarCreated"); }();
...
        if (message == WM_TASKBARCREATED)
        {
            _notificationIcon->ReAddNotificationIcon();
            return 0;
        }


src\cascadia\WindowsTerminal\NotificationIcon.cpp
void NotificationIcon::ReAddNotificationIcon()
{
    Shell_NotifyIcon(NIM_ADD, &_notificationIconData);
    Shell_NotifyIcon(NIM_SETVERSION, &_notificationIconData);
}

some need also? I think need debug :/

@Zeroes1 commented on GitHub (Oct 15, 2024): @DHowett I check latest canary build terminal-1.23.2852.0, also latest preview terminal-1.22.2702.0 check on Windows 10.0.19045.5011 (22H2) [TEST: pskill64.exe explorer.exe and after manually ran again explorer.exe] and confirm that it does not work - there is no re-registration of the icon in fact... Strange situation i see what code exist for this, but don't work... ``` \src\cascadia\WindowsTerminal\WindowEmperor.cpp static const UINT WM_TASKBARCREATED = []() { return RegisterWindowMessageW(L"TaskbarCreated"); }(); ... if (message == WM_TASKBARCREATED) { _notificationIcon->ReAddNotificationIcon(); return 0; } src\cascadia\WindowsTerminal\NotificationIcon.cpp void NotificationIcon::ReAddNotificationIcon() { Shell_NotifyIcon(NIM_ADD, &_notificationIconData); Shell_NotifyIcon(NIM_SETVERSION, &_notificationIconData); } ``` some need also? I think need debug :/
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#22403