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

Icon option in Dioxus.toml does not work on Windows #3648

Open
MrMcEpic opened this issue Jan 26, 2025 · 3 comments · May be fixed by #3753
Open

Icon option in Dioxus.toml does not work on Windows #3648

MrMcEpic opened this issue Jan 26, 2025 · 3 comments · May be fixed by #3753

Comments

@MrMcEpic
Copy link

MrMcEpic commented Jan 26, 2025

Problem

On Windows, if you try to change the location of your icon image via editing dioxus.toml under [bundle] using the icon variable, your choice is not respected when bundling for Desktop Windows. It will automatically default to project\\icons/icon.ico\

Additionally, the guide suggests a format like icon = "assets/favicon.png" however, on Windows, the tag is only parsed if passed as a sequence icon = ["assets/favicon.png"] That particular issue appears to happen on Linux as well in my testing.

Steps To Reproduce

Steps to reproduce the behavior:

  • Create Windows app
  • Set icon in Dioxus.toml
  • Attempt to bundle

Expected behavior

The icon should be selected from the path given in the icon tag.

Screenshots

Image

Environment:

  • Dioxus version: 0.6.2
  • Rust version: 1.84.0
  • OS info: Windows 11 Pro
  • App platform: Desktop Windows

Workaround

This can be worked around by creating the file and folder that Dioxus tries to access icons\icon.ico.

@MrMcEpic
Copy link
Author

MrMcEpic commented Jan 26, 2025

I believe the issue occurs in the function on line 120 of packages/cli/src/bundle_utils.rs or somewhere upstream from it.

@Klemen2
Copy link
Contributor

Klemen2 commented Feb 13, 2025

Windows requires the icon to be of type .ico so if you do not have an .ico it will fail since it will default to "icons\icon.ico" by tauri.

But even if you do that, the installed app won't have the icon because of the second problem.
Tauri does this extra step when building a windows app which is not done here.

So we would need to implement winres since wix does not setup this kinds of things for building the exe.

Their implementation uses a lot of environmental variables mostly cargo ones and also requires to add stuff to your Cargo.toml so I'm not sure what is the best solution here since implementing it will require quite a lot of changes.

@Klemen2
Copy link
Contributor

Klemen2 commented Feb 16, 2025

This line should not matter since it's only set if you specifically set settings for windows and don't set icon_path for it

icon_path: val.icon_path.unwrap_or("./icons/icon.ico".into()),

If you use the PR that I just did you can test if it still happens. If you want to set a specific icon for windows you will still need .ico file since it's not done automagically yet.

The problem was upstream with tauri default implementation. Now it shouldn't matter, but you need tools for winres installed if you want to build the windows app.

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 a pull request may close this issue.

2 participants