dioxus icon indicating copy to clipboard operation
dioxus copied to clipboard

feat: windows app icon + default icon from toml

Open Klemen2 opened this issue 10 months ago • 8 comments

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 avatar Feb 16 '25 20:02 Klemen2

Why didn't previous versions support Windows app icons?

photino avatar Apr 26 '25 11:04 photino

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

Klemen2 avatar Apr 26 '25 19:04 Klemen2

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

Klemen2 avatar Aug 12 '25 22:08 Klemen2

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.

pythoneer avatar Oct 21 '25 07:10 pythoneer

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
  • [x] 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
  • [x] 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 #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
  • [x] 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 avatar Oct 21 '25 08:10 Klemen2

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 avatar Oct 21 '25 09:10 Klemen2

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

Klemen2 avatar Oct 29 '25 20:10 Klemen2

I think the work here is relevant https://github.com/DioxusLabs/dioxus/pull/4958 idk.

pythoneer avatar Nov 25 '25 07:11 pythoneer

This PR https://github.com/DioxusLabs/dioxus/pull/5072 worked on the same code location and created a conflict.

pythoneer avatar Dec 11 '25 19:12 pythoneer