Custom icon in taskbar not showing with 0.73.0 - grey default icon only
The custom icon in the windows 11's taskbar is a grey default icon, with 0.73.0-sdk (or 'normal' non-sdk). It works flawlessly with 0.72.0 (and previous).
The odd thing with 0.73.0 is that the icon in the top-left corner (favico equivalent?) is there. The icon also is present in Task Manager (for the binary and all sub-processes spawned by nwjs too). And the icon also is fine with the Tray. But not on the main taskbar.
FYI: Disabling/enabling nw2 doesnt change the icon issue.
Attached: a printscreen of the nwjs icon (right) and the devtools icon (left). They used to both be my custom icon.

- Operating System: Windows 11 x64
- NW.js Version: 0.73.0 (sdk/normal)
- Code snippet:
In
package.json:
"window": {
"width": 1024,
"height": 654,
"title": "My App",
"icon": "foo/bar.png",
"min_width": 885,
"min_height": 518,
"show": false
},
in the js files after some background checks for the app to prepare to strat:
require('nw.gui').Window.get().show(true)
0.74 the same bug.
Hi! I'd like to work on this issue
I can confirm this happens in both Windows 10 and Windows 11 with 0.73.0 and 0.74.0 (both "normal" and SDK builds).
This issue does not occur in Linux (tried Ubuntu 22.04). It does seem to fail in macOS, but I might be doing something wrong there.
@EduardoMtz1 if you have a PR, please submit one.
@rogerwang please look into this for the next build.
has anyone had a look at the diff for 0.73.0 and 0.72.0 to see what changed?
0.75 the same bug. Seems nobody cares... ☹️
@rogerwang please provide an update. This prevents us from updating NW.js in our applications.
I confirm it's a regression since 0.73 (included)
I started digging into this and I noticed that the .ico file that you see is located here:
%UserProfile%\AppData\Local\<app-name>\User Data\Default\Web Applications\_nwjs_<jibberish>\<app-name>.ico
You can find the Windows .lnk file that points to this icon by:
- Right-click the taskbar icon
- On the pop-up menu, right-click on the name of the application
- Select Properties
- You'll see in the Shortcut file's (.lnk file) properties window, the .lnk file is located in
%UserProfile%\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\User Pinned\ImplicitAppShortcuts\<some hex id>\<app-name>.lnk - If you navigate to the
Shortuttab, and click theChange Iconbutton you'll see the above-mentioned .ico file.
I'm guessing it has something to do with which Chromium version we're using?
I found some other interesting things in the Chromium source code, talking about these ImplicitAppShortcuts here:
https://chromium.googlesource.com/chromium/src/+/main/docs/windows_shortcut_and_taskbar_handling.md
UPDATE: I dug through the Chromium source, and it looks like Chromium manages its own icon and "Relaunch details" See Chromium source here
The problem is GetIconFilePath() tries to find an icon by looking at the icons property in the chrome extension's manifest. If there is nothing there, then Chromium will use the default icon. The nw.js code supposedly populates the manifest by copying the icon path from the package.json's, but for some reason, in v0.73.0 and above, it seems this property doesn't end up in the nw.js-constructed manifest. I found that if force it by putting this in package.json, then Chromium will copy the icon to the AppData path as expected:
"icons": {
"256": "path/to/icon.png"
}
0.75.1 the same bug. 🤬
@nhogle your proposed workaround doesnt work for me on 0.75.1 anyway, but thanks for looking into it, maybe someone will be able to patch the issue
It's obviously not ideal and hopefully the issue can be addressed soon, but the workaround does work for me.
old
"window": {
"icon": "./build/my-icon.png"
},
new
"window": {
"icon": "./build/my-icon.png"
},
"icons": {
"256": "./build/my-icon.png"
},
Thanks! That does work*, I think I was using a .ico, not a .png.
* it works with nwjs window, not the devtool window, but I believe that's actually a good thing to have a nwjs icon for devtool and a custom icon for the app itself.
thanks @sysrage - this works for me as well
@rogerwang : I believe I have a fix for this issue: in nw::LoadNWAppAsExtensionHook(), the call to:
manifest->FindString("window.icon");
should actually be:
manifest->FindStringByDottedPath("window.icon");
I confirmed this by actually getting the source to compile on Windows (no easy feat!), and checking that we are getting an empty icon_path, but if we use FindStringByDottedPath, then we get the expected value from the manifest, and NW.js will tell Chromium what to do with the icon.
https://github.com/nwjs/nw.js/blob/25f89d17a8886776e3de62ae2f4a931ed13bf2de/src/browser/nw_extensions_browser_hooks.cc#L289
Would you like me to create a pull request with the changes?
@nhogle do it :) Best case scenario it's merged and it's 1-click for rogerwang, worse case you've put some effort into helping others
Another workaround that would replicate the full behavior (Set icon on both DevTools and the main window):
in package.json:
"window": {
"icon": "./build/my-icon.png"
"<other>": "<window-settings>"
"<...>": "<...>"
},
"window.icon": {
"icon": "./build/my-icon.png"
},
The bug is caused by NW.js using the wrong API call to look up the window.icon property path in the Manifest.
0.76 the same bug.
I have a pull-request open that should fix this issue. @rogerwang : Do you think you'll be merging my pull request to fix this bug before the next release? Thanks!
0.77 the same bug. 🤬