feat: add support for polling a variable once at startup #1367
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
For any
defpollvariable, if:intervalis zero, then its script is called exactly one time, and not scheduled for any future executions.Usage
Simply define something such as
(defpoll username :interval 0 "echo $USER")and instead of continuously calling theecho $USERscript (as is current behavior) it will instead just store$USERinsideusername. This is probably preferred as$USERshould not change while eww is running.Additional Notes
While week-long intervals and similar strategies exist, this creates a standard way to execute a command once for a variable. Fixes #883.
Checklist
Please make sure you can check all the boxes that apply to this PR.
docs/content/maindirectory has been adjusted to reflect my changes.cargo fmtto automatically format all code before committing