feat: windows app icon#3753
Conversation
|
Why didn't previous versions support Windows app icons? |
|
windows is windows and always needs something special, aka building a resource file with a specific program |
|
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 |
|
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.
I think this is everything unless @jkelleyrtp has anything to add, feel free to work on this |
|
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 |
|
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, |
|
I think the work here is relevant #4958 idk. |
This is a temporary fix until dx bundle is fixed. See: DioxusLabs/dioxus#3753 closes #8
|
This PR #5072 worked on the same code location and created a conflict. |
|
Sorry this has sat so long. I'm just not a fan of the winres approach. Deno built a crate called sui which can embed resources into binaries after they've been built. https://littledivy.com/sui.html It specifically handles embedding icons into PE (windows exe files). I would prefer we use sui to embed the icon for windows instead of the build.rs / winres system. Alternatively, we could perform the compilation of the icon in the CLI and then pass it in as a linker arg. https://claude.ai/share/b0f8e502-2932-4734-b4b0-da1241a262c1 I just don't want icon configuration to be done from within the build.rs. The dioxus.toml should be the source of truth for these configuration options and I might also just be misunderstanding the PR. It seems that the inlined winres system has code for printing link statements and reading the cargo_manifest_dir, which I don't think is applicable here |
|
winres was already doing compilation of the icon in the cli and was not using any cargo / build script since the first working version of this PR - basically what cloud suggested, the original was based on the tauri winres but this version is without embed_resource since it prints to the console, the tooling finder is from the script that zed is using winresource, I removed a bunch of irrelevant comments and unused stuff and also changed the structure a little I haven't tested the gnu toolkit or on other platforms, only mscv on windows only
|
|
relevant PR #5328 |
|
Would love to merge this. What's the current state? After digging into windows bundling recently, I have several thoughts:
It seems that on many platforms we need some sort of pre-processing step for icon generation (android as well, and mac/ios). This adds extra overhead in dev (slower dev-server starts until we properly parallelize things), which is why we've deferred it to bundle. I'm happy to add this step in dev too if folks think it's important. |
There was a problem hiding this comment.
As far as I know, wix / nsi settings only add icon to the installer, not the actual app.
the pr is basically doing cargo rustc -- -C link-arg=app.res where res needs to be compiled with rc.exe (or equivalent) because windows is special.
I don't think that dev builds necessarily need an icon, so atm you just get a warning if it can't be compiled.
I think that I only need to update a couple of things which I can probably do this weekend.
a32563d to
7df44e0
Compare
I don't think it's a good idea to do [default.extend-words] fo = "fo" as it's a very common mispelling for 'for'
|
I'd say this is ready, unless you want any changes in the windows scope. |
|
Thanks so much! |
|
The addition of Is anyone working on that? I couldn't find an open PR. I'd be willing to give it a try myself if that would be welcome. |
|
right now it's only used for the windows product name (app -> right click -> properties -> details) |
FYI I just raised #5533 for this |
Closes: #3648
Implement #3596 for windows
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