nw.js icon indicating copy to clipboard operation
nw.js copied to clipboard

nwjs taskbar icon on Windows for NW.js is a red square, can't set icon in package.json

Open frankhale opened this issue 5 years ago • 31 comments

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"
  }
}

frankhale avatar Nov 23 '19 22:11 frankhale

Could you provide a sample of the icon? It works for me.

rogerwang avatar Nov 24 '19 05:11 rogerwang

@rogerwang Not sure what is going on but I get the same thing - I tried the app on #7221 (transparency issue) and the icon is red square with nw2 (see attached graphic on #7221). I also tried one of my apps which works ok on OSX (apart from the shadow issue) and it also fails on nw2 - I get the red icon. All is OK if nw2 is disabled in the manifest. I think that #7222 is the same issue also. I was using Win 10 Pro 64bit (1803) in Parallels 13 VM on OSX 10.13.6.

Blatman avatar Nov 24 '19 10:11 Blatman

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:

toby

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.

image

frankhale avatar Nov 24 '19 14:11 frankhale

the same to me

zhsunlight avatar Nov 25 '19 00:11 zhsunlight

Same here image

kucix avatar Nov 25 '19 12:11 kucix

I can confirm this issue

sascha-schieferdecker avatar Nov 26 '19 07:11 sascha-schieferdecker

I have this problem too

khoshrou avatar Nov 26 '19 18:11 khoshrou

interesting ... it works for me with win10 and the default app. Could you try to clear the icon cache? https://www.winhelponline.com/blog/how-to-rebuild-the-icon-cache-in-windows/#script

iconscreenshot

rogerwang avatar Nov 28 '19 05:11 rogerwang

it works with latest (v0.43.0), but not with v0.42.5

zhsunlight avatar Nov 28 '19 05:11 zhsunlight

interesting ... it works for me with win10 and the default app. Could you try to clear the icon cache? https://www.winhelponline.com/blog/how-to-rebuild-the-icon-cache-in-windows/#script

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

image

image

kucix avatar Nov 28 '19 06:11 kucix

I just tested clean cache script and it still not working I still see a big red square

khoshrou avatar Nov 28 '19 07:11 khoshrou

Does --disable-features=nw2 make any difference there?

rogerwang avatar Nov 28 '19 08:11 rogerwang

yes,

standard run (0.42.5, 32b) image

disable nw2 (0.42.5, 32b) image

It's possible setting this flag in package.json? Or it's only command line argument?

kucix avatar Nov 28 '19 08:11 kucix

Yes it differs with --disable-features=nw2 image

normal image

khoshrou avatar Nov 28 '19 08:11 khoshrou

Yes. It can be used in package.json for now as a workaround.

rogerwang avatar Nov 28 '19 08:11 rogerwang

If I added --disable-features=nw2 to package.json, everything seems fine, but I can't open downloaded files - #7234

kucix avatar Nov 28 '19 09:11 kucix

I managed to reproduce it in another system. This is now fixed in git and will be available in the next nightly build.

rogerwang avatar Nov 28 '19 13:11 rogerwang

Thank you to everyone on this issue. You guys rock!

frankhale avatar Nov 28 '19 14:11 frankhale

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. Screenshot 2020-12-03 at 6 17 36 PM

When I use --disable-features=nw2 it works.

Using: nw.js v0.50.1 Screenshot 2020-12-03 at 6 17 16 PM

akshay-joshi avatar Dec 03 '20 13:12 akshay-joshi

Hi All

Tray icon is not visible as well. Below is the logic that I have used:

var trayObject = new gui.Tray({ title: 'MyApp', tooltip: 'MyApp is running', icon: '../../assets/myApp.png', });

My code structure is : assets -> myApp.png (1024 x 1024) tried myApp.ico (256 x 256) as well but didn't worked. src -> js -> index.js (creating tray object here. Refer above code)

akshay-joshi avatar Dec 04 '20 09:12 akshay-joshi

Yes, I'm having the same issue. image It doesn't happen in my main window, but since it uses an

YodaLightsabr avatar Jan 31 '21 21:01 YodaLightsabr

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.

codeweapon avatar Feb 16 '21 14:02 codeweapon

Could you provide a full sample including your icon file? It works for me with the sample from #4581

rogerwang avatar Feb 19 '21 01:02 rogerwang

@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.

codeweapon avatar Feb 19 '21 16:02 codeweapon

Could you upload your icon? I can look to fix it.

On Sat, Feb 20, 2021, 12:46 AM Vlad [email protected] 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 https://github.com/nwjs/nw.js/issues/7236#issuecomment-782195867, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABIMGNUU54C3CA6GX4URKDS72IXXANCNFSM4JQ4F3AA .

rogerwang avatar Feb 20 '21 05:02 rogerwang

pgAdmin4

akshay-joshi avatar Feb 22 '21 11:02 akshay-joshi

@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. Here is an example icon.

codeweapon avatar Feb 25 '21 06:02 codeweapon

I too am seeing a red icon while using 0.52.1, but only for newly opened windows. The image below shows the app icon (next to Notepad) correctly for the first window, then I used the app which triggered a normal window.open that resulted in the red square icon.

Screen Shot 2021-03-31 at 2 31 29 PM

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 --disable-features=nw2 does fix this icon issue. I guess I'll test the application thoroughly to see if there are other issues such as file downloads.

troywoy avatar Mar 31 '21 18:03 troywoy

NWjs 0.53.0

Hotkey Ctrl+U (Windows)

2021-05-04 12 09 27

panther7 avatar May 04 '21 10:05 panther7

Any workaround or fix for this please ?

adityatoshniwal avatar Feb 04 '22 11:02 adityatoshniwal