eww icon indicating copy to clipboard operation
eww copied to clipboard

Add :icon and :icon-size properties to the image widget

Open aperezdc opened this issue 2 years ago • 4 comments

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:

Launcher bar screenshot

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/main directory has been adjusted to reflect my changes.
  • [x] I used cargo fmt to automatically format all code before committing

aperezdc avatar Oct 21 '23 20:10 aperezdc

@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.

aperezdc avatar Oct 23 '23 13:10 aperezdc

Any news on this? Would like to see this feature!

Wunderharke avatar Dec 27 '23 11:12 Wunderharke

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! ✨

aperezdc avatar Dec 27 '23 21:12 aperezdc

I build this patch without problems and it is running fine for me on wayland.

Wunderharke avatar Dec 28 '23 10:12 Wunderharke

Thanks for merging this 🙌🏼

aperezdc avatar Apr 09 '24 09:04 aperezdc

Would this work for application icons? (e.g. for a taskbar widget)

Azarattum avatar Apr 25 '24 01:04 Azarattum

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 👍🏼

aperezdc avatar May 21 '24 13:05 aperezdc