-
First of all, wow, eww is a fantastic project and it is really a pleasure to work with. Using magic vars as an example, if I wanted to generate a widget for potentially more than one device (like a battery), I was hoping that I could do something like the following: (box
(for key, values in EWW_BATTERY
(label :text "${key} at ${values.capacity}"))) My intent here is to alleviate the need to know the name of the keys beforehand, but maybe there's some witchcraft that I can leverage something like Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
As far as I'm concerned, this is currently not possible. |
Beta Was this translation helpful? Give feedback.
-
Thanks for the input, @w-lfchen! That's helpful context. For future users, this is very possible via some of the jq filters that are available. Although there isn't necessarily a way to make
...and then index into it:
Other jq filters like |
Beta Was this translation helpful? Give feedback.
Thanks for the input, @w-lfchen! That's helpful context.
For future users, this is very possible via some of the jq filters that are available. Although there isn't necessarily a way to make
(for ...
accept a key/value dictionary directly, you can just reformat json structures in a variety of ways that you can then loop through. For example, acquire the keys toEWW_BATTERY
:...and then index into it:
Other jq filters like
to_entries
can help as well.