[FEATURE] Allow users to manually specify the polling rate for magic variables
Description of the requested feature
It would be nice if users could set a custom polling rate for the magic variables we use. The syntax for this is not yet clear, however, and I don't have any good ideas (any proposals are very welcome!).
Proposed configuration syntax
None yet :(
I'm thinking in other languages these would actually be function calls, something like EWW_NET(interval). How to achieve that in a lisp language, I don't know. Maybe having those be so-called "Magic Variables" isn't the best solution? Could they be anything else?
Or... functions in yuck when ?
Oh you do have functions! I've just realised round() and replace() were a thing.
Couldn't those magic variables be replaced with function calls then?
I just started configuring my status bar with Eww the other day, and this is a feature I'd really like to see. The default 2 second polling rate definitely feels sluggish sometimes.
Since we already have variables via defvar, maybe they can be reused for configuration, e.g. (defvar EWW_NET_INTERVAL "1s"). Using the builtin variable machinery would also allow modifying configuration variables during runtime with shell commands ($ eww update EWW_NET_INTERVAL=1s), which could enable some cool stuff like increasing the polling rate when network or hard disk activity is high. I haven't looked at the code, though, so I don't know if dynamic polling rates like that are reasonable to implement.
Alternatively, we could add something like a configure call if we want to keep the variable namespace clear of configuration. I'm thinking something to the effect of:
(configure EWW_NET
:interval "1s")
which would be evaluated once at the beginning of the program and applied to the runtime.