tauri-apps / tray-icon

Tray icons for Desktop Applications.
Apache License 2.0
211 stars 29 forks source link

fix(windows): tray icon gets blurry after changing dpi #145

Closed Legend-Master closed 5 months ago

Legend-Master commented 5 months ago

Fixes https://github.com/tauri-apps/tauri/issues/9335

Re-add tray icon on TaskbarCreated message

This is what Electron does

https://github.com/electron/electron/blob/b41da150caa363d06f522427c87bd989464c9edd/shell/browser/ui/win/notify_icon_host.cc#L244-L251 https://github.com/electron/electron/blob/b41da150caa363d06f522427c87bd989464c9edd/shell/browser/ui/win/notify_icon.cc#L114-L131

I don't quite understand why the Power Toys' implementation doesn't use the NIM_DELETE while still works

https://github.com/microsoft/PowerToys/blob/28ba2bd301f47250e53876d21d240ba5434bb7af/src/runner/tray_icon.cpp#L253-L257

The document didn't mention deleting the existing icon as well

When the taskbar is created, it registers a message with the TaskbarCreated string and then broadcasts this message to all top-level windows. When your taskbar application receives this message, it should assume that any taskbar icons it added have been removed and add them again. https://learn.microsoft.com/en-us/windows/win32/shell/taskbar#taskbar-creation-notification