fix(codegen): select largest ICO entry instead of first#15241
Conversation
Package Changes Through 55d4be5There are 12 changes which include tauri with minor, @tauri-apps/api with minor, tauri-build with minor, tauri-macos-sign with patch, tauri-bundler with minor, @tauri-apps/cli with minor, tauri-cli with minor, tauri-runtime with minor, tauri-runtime-wry with minor, tauri-utils with minor, tauri-plugin with minor, tauri-codegen with patch Planned Package VersionsThe following package releases are the planned based on the context of changes in this pull request.
Add another change file through the GitHub UI by following this link. Read about change files or the docs at github.com/jbolda/covector |
|
Thanks for contributing! Using the biggest image in the It seems like the way this was somewhat tackled way back in a80d5b7 by putting the 32x32 one to be the first entry 😂 Perhaps we could make it select the biggest entry under say 32x32 or 64x64 (64 × 64 × 4 = 16,384 bytes) for now, this should be a sufficient sized icon for the taskbar icons on most devices, and ideally we could add support of using the embedded resource icons as mentioned in #14596 (comment) |
|
we should also look into using tao's https://docs.rs/tao/latest/x86_64-pc-windows-msvc/tao/platform/windows/trait.WindowExtWindows.html#tymethod.set_taskbar_icon for large icons since you mentioned alt-tab which will use this one. |
|
Ok so Instead of using a decoded RGBA buffer, |
| let entry = icon_dir | ||
| .entries() | ||
| .iter() | ||
| .min_by_key(|e| e.width().abs_diff(32)) |
There was a problem hiding this comment.
I just opened #15274, with that, I think we might be able to remove this limit here
|
|
||
| #[cfg(windows)] | ||
| { | ||
| if let Ok(resource_icon) = TaoWindowIcon::from_resource(32512, None) { |
There was a problem hiding this comment.
Not sure if this is a good default, the task bar icon seems to fallback from ICON_BIG > ICON_SMALL > exe icon 🤔
And I don't think this belongs to here, it should be in the build method
Closes #14596
new_ico()intauri-codegenusesentries()[0]to select which image from an ICO file to embed as the window icon. Since ICO files conventionally store entries smallest-first, this picks the 16x16 image. When the OS needs a larger size (taskbar, alt-tab), it scales up from 16x16, resulting in a blurry icon.This selects the largest entry instead, giving the OS a high-resolution source to downscale from.
crates/tauri-codegen/src/image.rsrustfmt --checkandcargo check -p tauri-codegen