The official node-webkit wiki has a page regarding custom icons for applications.
Any thoughts on how to make the Windows build have a custom icon via Grunt?
Also see rogerwang/node-webkit#1078
The easiest way to replace the windows icon is to create an installer and change the shortcut icon. There is a installer called NSIS out there (http://nsis.sourceforge.net/Main_Page) which is scriptable. I don't use windows that much. http://icofx.ro/ seems to do the job - but this is another manual step
I'm looking for a way to change the icon from OS X, I'll let you know if I find anything.
Another solution would be to just build the Windows app on Windows, but still have a not cross-platform grunt task the takes care of the icon.
If it is possible as a standalone app (http://www.softpedia.com/get/Programming/Other-Programming-Files/Ranjhasoft-Icon-Changer.shtml) and http://stackoverflow.com/a/2760204, it should be possible with node/grunt.
@vladikoff I googled a bit and came across: https://anolis.codeplex.com it's a scriptable resource editor (Anolis.Resourcer). You could do stuff like:
Resourcer -op:del -src:tmp\nw.exe -type:14 -name:IDR_MAINFRAME
Resourcer -op:add -src:tmp\nw.exe -type:14 -name:IDR_MAINFRAME -file:resources\mdc72x72.ico
So it would be possible to replace the icon file with windows. Since it is opensource you could have a look on how they read and write into the exe file and make a port to nodejs :)
Found it here: https://github.com/geo8bit/nodebob/blob/master/build.bat#L33
Here's another idea I came across Resource Editor for Linux Question
The more or less well known ResourceHacker can be run from commandline. And it seems, that it should be possible to run it within wine, which is available on mac and linux.
So if wine is installed, just call the resourcehacker, and let it change the icons.
What do you think? Is it worth to think about it?
I really would like to have a solution to change the IDR_MAINFRAME Resources in node that is cross plattform. But since that is possible it would be a valid compromise.
I found the code, to run it:
wine ResHacker.exe -addoverwrite "source.exe", "target.exe", "new-icon.ico", ICONGROUP, IDR_MAINFRAME, 1033
Where source.exe, target.exe, new-icon.ico should be changed as desired.
There are some questions going through my head, which I think should be answered before implementing this feature:
Would you want to deploy ResHacker within this repository?
How can we check for wine being installed?
A penny for your thoughts.
Here's a branch which is currently tested on a mac: windows-icons
Dependencies are not shipped, but documented in the Readme.md
Let me know, if you are considering a merge!
Thanks, I'll have a look at it. Anolis.Resourcer - https://anolis.codeplex.com/ also seems to be a good fit and has the same API (and apparently doesn't crash that often). I'm working on a new branch https://github.com/mllrsohn/grunt-node-webkit-builder/tree/testing which includes mocha tests - would you be willing to add tests for your feature?
I thought about the testing, but since the ResourceHacker is an external dependency, which is not shipped (even not in the fixtures?) how would you want to test this?
Hmm I think we should ship ResourceHacker or Anolis.Resourcer just for convenience. You could mock the invokeResourceHacker function and check if it is called with the right params and check if the promises are resolved /rejected correctly.
Fixed in d851a67 using winresourcer: nwjs-community/nw-builder@d412cd3. You will need to have Wine installed on Mac & Linux. Eventually, it would be nice to get this switched out for cross platform module without the Wine dependency.