Skip to content

Conversation

@Klemen2
Copy link
Contributor

@Klemen2 Klemen2 commented Feb 16, 2025

image

Closes: #3648
Closes: #3596

Windows app resources will only be build with --release flag, otherwise it will be embedded (no app icon (thumbnail) or metadata when installed)

This pr also reduces the binary size since including icon is now deduplicated.

Added functions: default_icon, icon_from_memory, icon_from_path

Tested only on windows 11

@Klemen2 Klemen2 requested a review from a team as a code owner February 16, 2025 20:26
Building with winres is now mandatory since app may build but fail to run due to how default icon for window is managed

- fixed default bundle icon path fail for windows
@jkelleyrtp jkelleyrtp added the cli Related to the dioxus-cli program label Apr 9, 2025
@photino
Copy link
Contributor

photino commented Apr 26, 2025

Why didn't previous versions support Windows app icons?

@Klemen2
Copy link
Contributor Author

Klemen2 commented Apr 26, 2025

windows is windows and always needs something special, aka building a resource file with a specific program

@jkelleyrtp jkelleyrtp added this to the 0.7.0 milestone Jul 1, 2025
Klemen2 and others added 4 commits August 12, 2025 13:35
changed bundle_dir to build_dir
since the app icon is expected, winres should also be expected to avoid successful builds with the app not launching because of that
@Klemen2
Copy link
Contributor Author

Klemen2 commented Aug 12, 2025

In the docs somewhere there should be a notice that windows is very bad at updating app icons of installed apps, so if you bundle the app, install it, change the icon and bundle again and reinstall - it will look buggy with old icon in some places and new one on other, with the only fix being restarting the pc or at least restarting the explorer didn't seem to fix it on my machine

@pythoneer
Copy link
Contributor

pythoneer commented Oct 21, 2025

Anything left i can help with to bring this over the finish line? 0.7 is is nearing its release and i would love to not use a workaround for my current releases with 0.6 to have app icons.

@Klemen2
Copy link
Contributor Author

Klemen2 commented Oct 21, 2025

Anything left i can help with to bring this over the finish line? 0.7 is is nearing its release and i would love to not use a workaround for my current releases with 0.6 to have app icons.

There are a few changes that needs to be done.

  • 1. testing bundling apps for windows on mac/linux
  • 2. It should probably not fail to build for windows if you do not have the tooling, it should only fail for bundling and release builds this requires changing how default icon is handled on windows (embedded with include_bytes instead of loaded from_resource) and if that's the case notify the user that there will be no icon for the app
  • 3. Make it work with workspaces, since currently it doesn't compile unless you cd to the app crate itself (e.g will not work with 👩‍🏫 Add support for default-members #4811) - there should probably be a test for this so you see that it fails
  • 4. I noticed that the logs "Compiling Windows resource file with ..." gets outputted twice, it should just be once
  • 5. default icon handling for other platforms (related to 2. but ideally it would get it from the app itself and fallback to include_bytes for non release/bundle) -- not required for this PR, but would be nice for consistency
  • 6. caching the windows resource file so it only compiles when the associated files changes -- not required for this PR

I think this is everything unless @jkelleyrtp has anything to add, feel free to work on this

@Klemen2
Copy link
Contributor Author

Klemen2 commented Oct 21, 2025

microsoft has since added windows-resource to crates, but before they release anything it will be another half a year or more or it may not even be related to the resource compiler based on their sense of naming things

@Klemen2 Klemen2 changed the title feat: windows app icon + windows default icon from toml feat: windows app icon + default icon from toml Oct 29, 2025
@Klemen2
Copy link
Contributor Author

Klemen2 commented Oct 29, 2025

I think that this is pretty much finished now. From the comment above 1. is probably out of scope but should work if you have the tools setup correctly,
4. is not a big issue and I don't really know why is happening
6. would be nice to have, but not really important

@pythoneer
Copy link
Contributor

I think the work here is relevant #4958 idk.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli Related to the dioxus-cli program

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Icon option in Dioxus.toml does not work on Windows Feature Request: Default window/tray icon from toml

5 participants