Replies: 2 comments 1 reply
-
It's currently not possible to directly reference variables in script-vars, for several reasons. This might change in the future, but it has a good bit of implied complexity with regards to state management. A There would be multiple other ways to work around this currently: you could either have multiple script-vars for different time formats and cycle through using a different var - this is kinda ugly additionally, you can currently of course just implement the cycling outside of eww, and just have it be part of your format_time.pl script itself. |
Beta Was this translation helpful? Give feedback.
-
Hi, Regarding variables not created/ran until they are referenced, if you need to create a variable (defvar, defpoll, deflisten) without the need to visibly reference it, you can do something like the following:
Then place this dummy widget anywhere as a child within your window. For example:
|
Beta Was this translation helpful? Give feedback.
-
Hi,
I would like to implement a clock that displays the time in different formats. I want to be able to cycle through the different formats by clicking on it.
So I thought a construction like this would work:
So in effect you have a defvar that keeps track of the format that should be displayed and you pass that into a script that then formats the current time accordingly and you simply display this defpoll-variable.
However the above construction does not work ("error: Tried to reference variable
clock_state
, but we cannot access variables here") and because the clock_state variable is not used in a widget it is also not visible via "eww state" (is that a bug?).So is there a way to make an external script aware of the internal state of eww?
Ideally I would like to have both a way to pass variables to external-scripts as well as maybe an "eww get " command, so that an external script could easily obtain such variables-values by querying the daemon.
Beta Was this translation helpful? Give feedback.
All reactions