wails icon indicating copy to clipboard operation
wails copied to clipboard

V3 Windows - system tray icon no longer defaulting to app icon if none present

Open mbaklor opened this issue 3 months ago • 2 comments

Description

It seems this was broken by d58d4ba758036d1dfbb4ce525cbf412c0a3160c5 as it worked before and works when reverting the commit. What I get in the systray is the default Wails icon.

To Reproduce

create a systray app on Windows, add an app icon, run or build the app.

Expected behaviour

What we used to have, where the systray icon defaults to the app icon if one exists.

Screenshots

Image

Attempted Fixes

No response

System Details

# System

┌────────────────────────────────────────────────────────────────────────────────────────────┐
| Name              | Windows 10 Pro                                                         |
| Version           | 2009 (Build: 26200)                                                    |
| ID                | 25H2                                                                   |
| Branding          | Windows 11 Pro                                                         |
| Platform          | windows                                                                |
| Architecture      | amd64                                                                  |
| Go WebView2Loader | true                                                                   |
| WebView2 Version  | 142.0.3595.53                                                          |
| CPU               | 12th Gen Intel(R) Core(TM) i7-12700                                    |
| GPU 1             | Intel(R) UHD Graphics 770 (Intel Corporation) - Driver: 32.0.101.6881  |
| Memory            | 16GB                                                                   |
└────────────────────────────────────────────────────────────────────────────────────────────┘

# Build Environment

┌─────────────────────────────────────────────────────────────────────────────────────────────────────┐
| Wails CLI      | v3.0.0-dev                                                                         |
| Go Version     | go1.25.4                                                                           |
| Revision       | 75ff8e215dafa6d1c12845b90f87362d202f93eb                                           |
| Modified       | false                                                                              |
| -buildmode     | exe                                                                                |
| -compiler      | gc                                                                                 |
| CGO_CFLAGS     |                                                                                    |
| CGO_CPPFLAGS   |                                                                                    |
| CGO_CXXFLAGS   |                                                                                    |
| CGO_ENABLED    | 1                                                                                  |
| CGO_LDFLAGS    |                                                                                    |
| DefaultGODEBUG | containermaxprocs=0,decoratemappings=0,tlssha1=1,updatemaxprocs=0,x509sha256skid=0 |
| GOAMD64        | v1                                                                                 |
| GOARCH         | amd64                                                                              |
| GOOS           | windows                                                                            |
| vcs            | git                                                                                |
| vcs.modified   | false                                                                              |
| vcs.revision   | 75ff8e215dafa6d1c12845b90f87362d202f93eb                                           |
| vcs.time       | 2025-11-11T15:36:13Z                                                               |
└─────────────────────────────────────────────────────────────────────────────────────────────────────┘

# Dependencies

┌────────────────────────────────────────────┐
| npm                        | 11.6.2        |
| NSIS                       | v3.11         |
| MakeAppx.exe (Windows SDK) | Not Installed |
| MSIX Packaging Tool        | Not Installed |
| SignTool.exe (Windows SDK) | Not Installed |
|                                            |
└───────── * - Optional Dependency ──────────┘

# Checking for issues

 SUCCESS  No issues found

# Diagnosis

 SUCCESS  Your system is ready for Wails development!

Additional context

No response

mbaklor avatar Nov 11 '25 18:11 mbaklor

👋 Thanks for reporting this issue! To help us investigate, could you please:

  1. Add the output of wails doctor if not already included
  2. Provide clear steps to reproduce the issue
  3. If possible, create a minimal reproduction of the issue

This will help us resolve your issue much faster. Thank you!

github-actions[bot] avatar Nov 11 '25 18:11 github-actions[bot]

I think I found the change that did it.

In v3/pkg/application/systemtray_windows.go, line 228:

	defaultIcon := getNativeApplication().windowClass.Icon

this takes the icon calculated during app creation (application_windows.go:209) which uses w32.IDI_APPLICATION to get the app icon. I have no idea what that means, but the original line in systemtray_windows.go was:

	defaultIcon := w32.LoadIconWithResourceID(w32.GetModuleHandle(""), w32.RT_ICON)

which uses w32.RT_ICON. When I replace the first line with the second I get the correct systray icon in my app.

mbaklor avatar Nov 12 '25 13:11 mbaklor