eww
eww copied to clipboard
[FEATURE] widget-local state
To anyone desperately waiting for this: I am, too, but it's still gonna take some time, as a large statemanagement rework is first required, that has already cost me a lot of braincells...
In the future, it should be possible to have variables be local to a widget. This would allow for reusable widgets to have their own, isolated state, making it significantly easier to implement generic, dynamic UI elements.
For this, a couple of things are necessary.
First and foremost, the already planned statemanagement rework needs to take place, to make this possible.
Secondly, Syntax for defining and updating local variables needs to be defined and implemented. Here we could either go with a classic let
Syntax, as is popular in most lisps, or have a special variables block of some kind.
(defwidget foo []
(locals [(defvar something "default")]
(button :onclick (set something "new value")
"click me")))
the way to update these would most likely be adding a set
Form as a valid value for onclick
and similar attributes.
For consistency, shell commands should then maybe also fall under a (shell
notify-send foo)` Syntax, although that would be a breaking change.
Its also not yet clear if locals should also allow for script vars.
(comment moved to https://github.com/elkowar/eww/discussions/453#discussioncomment-2872743)