feat(cli): add option to make custom icon sizes, closes #5121#5246
feat(cli): add option to make custom icon sizes, closes #5121#5246lucasfernog merged 20 commits intotauri-apps:devfrom
Conversation
|
Feature requested in this issue. Some keynotes:
|
|
I don't think there is any value in making it possible to generate custom .ico files. Just like the .icns file it's basically "complete" and there shouldn't be an actual use case requiring different layer sizes. It's a good start btw! :) i'll wait with the code nitpicking until it's more feature complete, but one thing already, you can use serde_json::from_reader instead of from_slice. It's a little cleaner and probablyyy faster. |
|
Hello 👋 Do you still have interest in working on it or should we take it from here? A few open points i see at first glance:
|
|
I was kinda tight on schedule at moment, but i think i can work on it this
weekend, you can leave it to me.
Vào 22:04, T.5, 8 Th12, 2022 Fabian-Lars ***@***.***> đã viết:
… Hello 👋
Sorry for the super long delay, it thought you weren't done and then
forgot about it after some time :/
Do you still have interest in working on it or should we take it from here?
A few open points i see at first glance:
- It still supports ICO files. As said earlier i don't think this
offers much value because the default ico is already "complete"
- There's still a todo for the file name, but that's imo not important
because of my next point
- I don't really like the json approach anymore tbh. I think we should
go with a more direct cli interaction. What i have in mind right now would
be a cli argument that takes an array of sizes, for example tauri icon
--extra 123,420,1337, which just reuses the existing png loop,
including the default naming scheme. I think letting the users rename the
files if needed is not too much to ask for.
—
Reply to this email directly, view it on GitHub
<#5246 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AKBJSIICA7VXTKSALKQCZX3WMH2GNANCNFSM6AAAAAAQRDI434>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
cargo tauri icon icon.png --extra 13,15,17\nthis generate png icons: 13x13.png, 15x15.png,17x17.png
|
I made some changes, can you have a look? @FabianLars . It remove json config, and --extra flags generate custom sizes .png with same naming scheme. |
In my opinion it should create additional files, and keep building the default at the same time. |
|
How is it? If you decide to take it, I'll cleanup the comments and test icon files. |
|
Yeah i like that. Another thing we may wanna look into is de-duplication so that we don't end up generating the same icon twice - that can be added after the cleanup ofc. |
FabianLars
left a comment
There was a problem hiding this comment.
Thanks so far! Only some small-ish things left. On top of what's mentioned in the comments we also need a changefile, example: https://github.com/tauri-apps/tauri/blob/dev/.changes/is-minimized.md
FabianLars
left a comment
There was a problem hiding this comment.
imo it's good as-is, thanks!
2 potential changes/improvements we may wanna think about anyway:
- make the extra_icon_sizes arg an
Optionso that all the new code is basically skipped for most users - If we want to make users able to generate 256 and 512 icons with the default name (on top of the 2 hard coded names), we'd have to hard code the creation of the 128x128@2x.png and icon.png icons outside the for loop.
At this point we could get rid of the whole dedup logic by also hard coding the removal of 32px and 128px icons from the extra icons vec 🤷
|
I don't really get making extra_icon_sizes as |
|
I altered the icon sizes, as you said, it removes the dedup logic, looks better to me. Do u want it or switch back to the old commit ? |
Doesn't really matter anymore. Without the dedup logic it would add more visual clutter than its worth. One last thing: The 32 and 128 icon sizes are missing now. |
|
So it's done after switching back to prev commit ? |
|
That would introduce the 256 / 512 naming problem from earlier. Honestly just do something like this again for size in [32, 128].into_iter().chain(extra_icon_sizes) {}and call it a day. We had so many iterations that i'm not sure anymore what i'd like to see at this point 😅 Thanks for following through btw! |
|
Sorry that it was such a pain. I'm quite new to this PR reviewing stuff x) Thank you again! |
|
Thx a bunch, Im a newbie and was busy recently, so i cant focus entirely on this, it such a pain. Anyways, thanks a lot for your guide |
|
LGTM, but maybe we should change it to only run the user-specified icon sizes? Like instead of running |
|
That was indeed the initial idea from the others, but i thought it feels a bit weird (idk why) so i asked to start with this approach first and wait for other opinions |
|
I've pushed that. We have time to get feedback and revert it if it feels weird :) we still need to audit the next release anyway. |
… (tauri-apps#5246) Co-authored-by: Fabian-Lars <fabianlars@fabianlars.de> Co-authored-by: Lucas Nogueira <lucas@tauri.studio>
What kind of change does this PR introduce?
Does this PR introduce a breaking change?
Checklist
fix: remove a typo, closes #___, #___)Other information