Skip to content

Commit

Permalink
Merge pull request #6 from Eiyeron/notif_icon_refresh
Browse files Browse the repository at this point in the history
Recreate the notification icon on failure to add it.
  • Loading branch information
jlaumon authored Jul 8, 2024
2 parents 1ee8975 + 8499e0a commit 42599c9
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/Notifications.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,14 @@ void gNotifInit(void* inHwnd)
gStringCopy(nid.szTip, gApp.mMainWindowTitle);

bool ret = Shell_NotifyIconA(NIM_ADD, &nid);
// If the program is killed without letting it clean up its icon, the next launch's add will fail.
// Deleting that "zombie" icon first before recreating it allows to "refresh" the icon ourselves.
if (!ret)
{
ret = Shell_NotifyIconA(NIM_DELETE, &nid);
gAssert(ret);
ret = Shell_NotifyIconA(NIM_ADD, &nid);
}
gAssert(ret);

// NOTIFYICON_VERSION_4 is prefered
Expand Down

0 comments on commit 42599c9

Please sign in to comment.