Repository navigation
Fix Windows systray icon regression - #4706
leaanthony merged 2 commits into
Conversation
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
|
Caution Review failedThe pull request is closed. WalkthroughA changelog entry documents a Windows systray icon bug fix that restores default app icon behavior when no custom icon is provided. The fix modifies the icon loading mechanism in the systray implementation to use resource-based icon retrieval instead of application window class reference. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes
Possibly related PRs
Suggested labels
Poem
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro 📒 Files selected for processing (2)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
|
Semgrep found 1 Risk: Affected versions of rollup are vulnerable to Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting'). Manual Review Advice: A vulnerability from this advisory is reachable if you use Rollup to bundle JavaScript with Fix: Upgrade this library to at least version 3.29.5 at wails/v3/examples/dev/frontend/package-lock.json:569. Reference(s): GHSA-gcx4-mw62-g8wm, CVE-2024-47068 |
* Fix Windows systray icon regression (wailsapp#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: wailsapp#4704 * Update changelog for systray icon fix --------- Co-authored-by: Claude <noreply@anthropic.com>



Summary
Fixes a regression where the Windows systray icon no longer defaults to the application icon when no custom systray icon is provided.
Fixes #4704
Problem
After commit d58d4ba (#4653), the systray icon on Windows would display the default Wails icon instead of the application's custom icon when no explicit systray icon was set. This broke the expected behavior where the systray should automatically use the app's icon as a fallback.
Root Cause
The regression was introduced on line 228 of
systemtray_windows.gowhere the default icon loading was changed from:To:
The getNativeApplication().windowClass.Icon approach doesn't correctly load the application's icon resource, while w32.LoadIconWithResourceID with w32.RT_ICON properly loads the app icon from the resource with the correct resource type identifier.
Solution
Revert the default icon loading back to using w32.LoadIconWithResourceID(w32.GetModuleHandle(""), w32.RT_ICON), which correctly loads the application's icon resource.
Testing
Verified the change addresses the specific line identified in the issue report
The fix restores the original behavior from before commit d58d4ba
Changes
Modified v3/pkg/application/systemtray_windows.go:228 to restore proper icon loading
Note: This is a minimal, surgical fix that only changes the single line that caused the regression, maintaining all other improvements from the refactor PR #4653.
Summary by CodeRabbit
Bug Fixes