-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
nwjs taskbar icon on Windows for NW.js is a red square, can't set icon in package.json #7236
Comments
Could you provide a sample of the icon? It works for me. |
@rogerwang |
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. |
the same to me |
I can confirm this issue |
I have this problem too |
interesting ... it works for me with win10 and the default app. Could you try to clear the icon cache? |
it works with latest (v0.43.0), but not with v0.42.5 |
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. Windows 10 Pro, version 1903, build 18362.476 |
I just tested clean cache script and it still not working |
Does |
Yes. It can be used in |
If I added |
I managed to reproduce it in another system. This is now fixed in git and will be available in the next nightly build. |
Thank you to everyone on this issue. You guys rock! |
Hi All Tray icon is not visible as well. Below is the logic that I have used: var trayObject = new gui.Tray({ My code structure is : |
I can confirm that this issue with the taskbar icon for Windows 10 still persists. I am using the 0.51.1 version of nw.js and the taskbar icon always defaults doesn't matter what I am doing. Even though the .exe icon is changing on the build and behaves as expected. |
Could you provide a full sample including your icon file? It works for me with the sample from #4581 |
@rogerwang Thank you for your reply. I figured it out. I had a small size for the icon and that's why it didn't work. Now I'm using 256 x 256 and looks like it's a safe size. There is a lot of confusion with the taskbar icon because it has to be png, not .ico and it needs to be a specific size. It worth pointing out that part in the documentation in more detail. |
Could you upload your icon? I can look to fix it.
…On Sat, Feb 20, 2021, 12:46 AM Vlad ***@***.***> wrote:
@rogerwang <https://github.com/rogerwang> Thank you for your reply. I
figured it out. I had a small size for the icon and that's why it didn't
work. Now I'm using 256 x 256 and looks like it's a safe size. There is a
lot of confusion with the taskbar icon because it has to be png, not .ico
and it needs to be a specific size. I worth pointing out that part in the
documentation in more detail.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#7236 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AABIMGNUU54C3CA6GX4URKDS72IXXANCNFSM4JQ4F3AA>
.
|
@rogerwang Thank you for your attention. I tried to use a smaller icon 48x48 and it didn't work for me. Just showing up as a default one. |
I too am seeing a red icon while using I saw a suggestion saying to try disabling nw2 but then read that caused downloaded files to possibly fail. Any suggestions or guidance would be great as I'm pretty new to NW.js. Edit: Using |
Any workaround or fix for this please ? |
Hi @rogerwang |
📚 The icon guide to fix everythingOr i hope most of the issues you could encounter like me. 🪟 Change window icon (top-left)
// package.json
{
// ...
"window": {
"icon": "path.png" // Relative path are from the NW.exe location. Image cannot be .ico
// Image needs to be a perfect square to not be streched.
// However, too large images are slower to load so consider putting 128px to 1024px size instead of a 240MB 4K full HD image-
// "toolbar": true, // Not necessary
// "width": 1000, // Not necessary
// "height": 800, // Not necessary
// "position": "center", // Not necessary
// "resizable": true // Not necessary
},
// ...
} 💻Change taskbar icon
// package.json
{
// ...
"icons": {
"256": "path.png" // Relative path are from the NW.exe location. Image cannot be .ico
// Image doesn't need to be 256px, but needs to be a perfect square to not be streched.
// However, too large images are slower to load so consider putting 128px to 1024px size instead of a 240MB 4K full HD image-
},
// ...
} 📲 Change executable icon
🖥️ Change Tray icon (bottom right of your desktop)// if nw is undefined use require("nw.gui") instead
var tray = new nw.Tray({
title: 'Tray name', // Mac only as Windows displays natively the icon
tooltip: 'Hover text', // In my example picture its "POG Cardinal 2"
icon: "path.png", // Relative path are from the NW.exe location. Image cannot be .ico
}); 🟥 Workarounds red square on new opened windowsBest fixThe best workaround i've found that far is this one, from this issue. require('nw.gui').Window.get().on('new-win-policy',function(frame, url, policy){
policy.ignore();
// The lext line open a new window with the red square issue
// chrome.windows.create({url:"https://google.com",type:"normal",focused:true});
//The next line open a new window stacked with the main one.
require('nw.gui').Window.open(url,{frame:true,focus:true}); // {frame:true,focus:true} is not necessary
}); You can also use it in standalone directly with using Other fixYou can add the following into your package.json, but keep in mind that this is not intended to fix this bug specifically. // package.json
{
// ...
"chromium-args": "--disable-features=nw2"
// ...
} ❔ Sources
|
Closing this issue since it's 5 years old and there is no new response by developer. The guide just posted seem to be the best way to work around the problems. |
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.
The text was updated successfully, but these errors were encountered: