Skip to content
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

✨ Set icons and metadata to Windows executables #268

Merged
merged 5 commits into from
Aug 19, 2024

Conversation

CosmoMyzrailGorynych
Copy link
Contributor

@CosmoMyzrailGorynych CosmoMyzrailGorynych commented Jun 16, 2024

Closes the following issues:

This PR allows the neu build command to patch Windows executables with user-provided metadata and icon. This all is fully cross-platform. Icons are accepted in PNG format for ease of use and use in possible further improvements on making MacOS or Linux packages.

This introduces the following optional keys to neutralino.config.json: (the keys are top-level)

  • author: gets written into executable's metadata.
  • description: gets written into executable's metadata.
  • copyright: gets written into executable's metadata. Defaults to current date + generic "all rights reserved".
  • applicationName: gets written into executable's metadata. Defaults to cli.binaryName.
  • applicationIcon: a relative path to an icon in .png format. Defaults to modes.window.icon. If it is not set, uses Neutralinojs logo.

Two npm packages were introduced as direct dependencies:

  • resedit
  • png2icons, this package can also be used in the future to bake icons for MacOS.

No native or platform-specific dependencies. Yay!

Possible backwards incompatibility:

  • If a user doesn't fill any of the new fields AND has an icon in modes.window.icon that is not in PNG format, the neu build command will fail as the windows patcher expects an icon in a PNG format. Perhaps I shouldn't look for an icon in modes.window.icon at all?

I'm open to improvements of this PR and will also make a PR for docs if/when this gets approved.

@CosmoMyzrailGorynych
Copy link
Contributor Author

CosmoMyzrailGorynych commented Jun 16, 2024

Example output:
изображение

Not setting any of the new fields and not setting an icon still produces a .exe with a nice icon:
изображение

Copy link
Member

@shalithasuranga shalithasuranga left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @CosmoMyzrailGorynych Thanks so much for your pull request. Please note that, at this moment of the project, we need to support older Node versions. Could you please adhere to this notice and use || and ternary if / && instead of ?. and ??. Thanks 🎉

Edit: Also, please make sure to resolve merge conflicts, Thanks

@CosmoMyzrailGorynych
Copy link
Contributor Author

Sure

@CosmoMyzrailGorynych
Copy link
Contributor Author

I assume you're targeting node.js v8+. Is it correct?

@CosmoMyzrailGorynych
Copy link
Contributor Author

🤔 Readme tells you need Node.js v14+ but ?? and ?. was introduced exactly in v14.0.0. What version is the minimum one???

@shalithasuranga
Copy link
Member

Hello, thanks for posting your findings. According to this issue, seems like the minimum version should be 12 (We need to update the readme file it sounds :) ). Thanks 🎉

@CosmoMyzrailGorynych
Copy link
Contributor Author

@shalithasuranga done.

@shalithasuranga
Copy link
Member

shalithasuranga commented Aug 19, 2024

@CosmoMyzrailGorynych thanks so much. Sorry for the trouble, could you please sync with the latest code. Thanks so much 🎉

@CosmoMyzrailGorynych
Copy link
Contributor Author

@shalithasuranga done.

@CosmoMyzrailGorynych
Copy link
Contributor Author

CosmoMyzrailGorynych commented Aug 19, 2024

Btw, in case a question rises where executables should ever be patched when Neutralino is inside a host project, one often overlooked "feature" of Windows is antiviruses and firewalls that love to block everything. Metadata and an icon will show in antiviruses' and firewalls' dialogs indicating that it is the app a user wants to run, not some "random, unknown" Neutralino 😄

By the very same reason I'm patching Bun binaries when it is run by Neutralino.

Copy link
Member

@shalithasuranga shalithasuranga left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks so much for your work @CosmoMyzrailGorynych. I'll release a new version with the newly added features soon! We can update the documentation (by adding config.author, etc, and other details) after releasing the next version 🎉

@shalithasuranga
Copy link
Member

Btw, in case a question rises where executables should ever be patched when Neutralino is inside a host project, one often overlooked "feature" of Windows is antiviruses and firewalls that love to block everything. Metadata and an icon will show in antiviruses' and firewalls' dialogs indicating that it is the app a user wants to run, not some "random, unknown" Neutralino 😄

By the very same reason I'm patching Bun binaries when it is run by Neutralino.

Yeah, this feature is great for every Windows's Neutralinojs app user and app developer. Thanks 🎉

@shalithasuranga shalithasuranga merged commit a1e0237 into neutralinojs:main Aug 19, 2024
2 checks passed
@CosmoMyzrailGorynych
Copy link
Contributor Author

Thank you for merging it. I will prepare a follow-up PR for docs soon.
You should probably close this issue: neutralinojs/neutralinojs#1057

@shalithasuranga
Copy link
Member

Sure @CosmoMyzrailGorynych thanks 🎉 The issue is closed now 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants