Fix Windows systray icon regression (#4706)

* Fix Windows systray icon regression (#4704)

This fixes a regression introduced in commit d58d4ba where the systray
icon no longer defaults to the application icon when no custom icon is
provided.

The issue was that the default icon loading was changed from:
  defaultIcon := w32.LoadIconWithResourceID(w32.GetModuleHandle(""), w32.RT_ICON)

To:
  defaultIcon := getNativeApplication().windowClass.Icon

This caused the systray to display the default Wails icon instead of
the application's custom icon.

The fix reverts the default icon loading back to using
w32.LoadIconWithResourceID with w32.RT_ICON, which correctly loads
the application's icon resource.

Fixes: #4704

* Update changelog for systray icon fix

---------

Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
Lea Anthony 2025-11-13 07:57:46 +11:00 committed by GitHub
commit 54d5b989bb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 2 additions and 1 deletions

View file

@ -23,6 +23,7 @@ After processing, the content will be moved to the main changelog and this file
## Fixed
<!-- Bug fixes -->
- Fix Windows systray icon not defaulting to application icon when no custom icon is provided (#4704)
## Deprecated
<!-- Soon-to-be removed features -->

View file

@ -225,7 +225,7 @@ func (s *windowsSystemTray) run() {
s.uid = uint32(s.parent.id)
// Resolve the base icons once so we can reuse them for light/dark modes
defaultIcon := getNativeApplication().windowClass.Icon
defaultIcon := w32.LoadIconWithResourceID(w32.GetModuleHandle(""), w32.RT_ICON)
// Priority: custom icon > default app icon > built-in icon
if s.parent.icon != nil {