nw.js: nwjs taskbar icon on Windows for NW.js is a red square, can't set icon in package.json
NWJS Version : 0.42.5 SDK version Operating System : Windows 10 (x64)
Expected behavior
You should be able to set the icon associated with NW.js using the provided method of setting “icon” in the “window” section of the package.json file.
Actual behavior
The icon associated with the NW.js application is a red square and cannot be set using the provided methods in the package.json. See screenshot in the comments below.
How to reproduce
Download 0.42.5 SDK for Windows x64 and set your package.json to be like:
NOTE: This is not a path problem as it works fine in 0.40.
{
"name": "app-name-here"
"main": "index.html",
"window": {
"icon": "image.png"
}
}
About this issue
- Original URL
- State: open
- Created 5 years ago
- Comments: 31 (9 by maintainers)
Commits related to this issue
- nw2: Fix windows icon Fix nwjs/nw.js#7236 — committed to nwjs/chromium.src by rogerwang 5 years ago
I managed to reproduce it in another system. This is now fixed in git and will be available in the next nightly build.
If I switch between 0.42.3 and 0.42.5, icon work in 0.42.3 and doesn’t work in 0.42.5, so it’s not icon cache (and users won’t clear it)
Same just now with clean base, only extracted. I tested both 32 and 64 bit version and both SDK and non-SDK versions with same results.
Windows 10 Pro, version 1903, build 18362.476
I don’t think a sample is really needed of my icon because the same icon works fine in NW.js 0.40.0 and in much older releases. I’ve been using the same icon for my app for a lot of years.
Here is my icon:
Just running NW.js demonstrates the behavior. Here is a screenshot of it. Notice that the task bar icon is a red square. When you attempt to set the icon in the package.json it doesn’t work.
I am still facing this issue while developing my application.
Scenario: My application launches multiple new windows depending on the condition set by the users. I used “window.open(url, ‘_blank’);” which is an existing logic that I can’t change.
To set the common height, width and icon for all windows I used the below logic:
currWin.on(‘new-win-policy’, function(frame, url, policy) { policy.setNewWindowManifest({ ‘icon’: ‘…/assets/app.png’, ‘frame’: true, ‘width’: 1300,
‘height’: 900,
‘position’: ‘center’, }); });
The above is working fine on OSX, but when runs on Windows 10 I am still getting a red icon for the newly open window. Please refer to the below screenshot.
When I use --disable-features=nw2 it works.
Using: nw.js v0.50.1