Add :icon and :icon-size properties to the image widget
Description
Add a new :icon property which allows using icons from the currently selected theme. For completeness, add :icon-size as well. As a nice extra, GTK automatically makes such images follow the selected icon theme.
Usage
The following shows how to use an image from the icon theme using the new properties:
(defwindow icon-example
:monitor 0
:geometry (geometry :width "64px" :height "64px")
(image :icon "dialog-information"
:icon-size "dialog"))
Showcase
Bar with launchers, each one is a (button :onclick "..." :tooltip "..." (image :icon "...")) element:
Short screen capture showing how the icons follow the current GTK icon theme:
https://github.com/elkowar/eww/assets/723451/d89b1627-af3c-461a-aff9-1092c4f2d1de
Additional Notes
First contribution, after discovering Eww yesterday. I hope the changes are done well.
Checklist
Please make sure you can check all the boxes that apply to this PR.
- [x] All widgets I've added are correctly documented.
- [x] I added my changes to CHANGELOG.md, if appropriate.
- [x] The documentation in the
docs/content/maindirectory has been adjusted to reflect my changes. - [x] I used
cargo fmtto automatically format all code before committing
@elkowar Could you take a look, please? I think this should be ready for review, I've been test driving it for a few days without any hitch.
Any news on this? Would like to see this feature!
Any news on this? Would like to see this feature!
I have been using Eww with this patch daily since the day I submitted it, works great for me. I have just rebased it and would pretty much like to have it merged, or if there's something wrong with it I would be more than happy to have some feedback and rewrite the patch accordingly.
Cheers, and happy solstice! ✨
I build this patch without problems and it is running fine for me on wayland.
Thanks for merging this 🙌🏼
Would this work for application icons? (e.g. for a taskbar widget)
Would this work for application icons? (e.g. for a taskbar widget)
Yes, it will work for any icon present in the currently active icon theme 👍🏼