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

[feat] add a macro to help using image as tray icon from rust api directly #9947

Closed
Legend-Master opened this issue Jun 3, 2024 · 4 comments · Fixed by #9959
Closed

[feat] add a macro to help using image as tray icon from rust api directly #9947

Legend-Master opened this issue Jun 3, 2024 · 4 comments · Fixed by #9959

Comments

@Legend-Master
Copy link
Contributor

Describe the problem

Currently to use an image (png or ico) in system tray, you need to enable image-png or image-ico feature which embeds image crate to the final app, and to not do that, you need to either transform your image to raw format or create it through config file

Describe the solution you'd like

Add a macro to do this, like what we had for config files

Alternatives considered

No response

Additional context

No response

@Legend-Master Legend-Master changed the title [feat] add an option to directly use image as tray icon from rust api [feat] add a macro to help using image as tray icon from rust api directly Jun 3, 2024
@amrbashir
Copy link
Member

I like the idea, I don't generally appreciate including image crate in the final app. Do you have an example of how the API should look like?

@Legend-Master
Copy link
Contributor Author

Maybe something like tray_icon_image!("../icons/tray_icon.png")?

@amrbashir
Copy link
Member

I see, I thought it involved more tray related code but I guess now that I understand the intention, this could be more than just for tray so I'd suggest just calling it image!() so it can be used also with windows and menus

@Legend-Master
Copy link
Contributor Author

Legend-Master commented Jun 4, 2024

Makes sense, and since those images are fairly small, it should be better than shipping the image crate (32 x 32 x 4 is around 4 KB), I think we need to also improve the docs a little bit, I thought it's going to just embed the image but it actually is raw pixels, and the image I was using is like 256 x 256, it's just 4 KB for a png, but raw pixels are quite big, should probably be more clear about what it's doing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants