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

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

Merged
merged 1 commit into from
Apr 6, 2024

Conversation

aperezdc
Copy link
Contributor

@aperezdc aperezdc commented Oct 21, 2023

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:

screenrecord.mp4

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.

  • All widgets I've added are correctly documented.
  • I added my changes to CHANGELOG.md, if appropriate.
  • The documentation in the docs/content/main directory has been adjusted to reflect my changes.
  • I used cargo fmt to automatically format all code before committing

@aperezdc aperezdc force-pushed the aperezdc/image-icon branch from 2747d17 to 7878fbe Compare October 21, 2023 20:41
@aperezdc
Copy link
Contributor Author

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

@Wunderharke
Copy link

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

@aperezdc aperezdc force-pushed the aperezdc/image-icon branch from 7878fbe to a7c53c3 Compare December 27, 2023 21:43
@aperezdc
Copy link
Contributor Author

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

@Wunderharke
Copy link

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

Copy link

@Wunderharke Wunderharke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is running fine in my build, code is clean. Please merge.

@aperezdc aperezdc force-pushed the aperezdc/image-icon branch from a7c53c3 to 90ea0d4 Compare February 19, 2024 15:10
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.
@aperezdc aperezdc force-pushed the aperezdc/image-icon branch from 90ea0d4 to 414363d Compare March 31, 2024 22:08
@elkowar elkowar merged commit 5fdaa4e into elkowar:master Apr 6, 2024
1 check passed
@aperezdc aperezdc deleted the aperezdc/image-icon branch April 9, 2024 09:37
@aperezdc
Copy link
Contributor Author

aperezdc commented Apr 9, 2024

Thanks for merging this 🙌🏼

@Azarattum
Copy link

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

@aperezdc
Copy link
Contributor Author

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

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

Successfully merging this pull request may close these issues.

4 participants