Skip to content

feat: add support for polling a variable once at startup #1367

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

aspen-otr
Copy link

Description

For any defpoll variable, if :interval is 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 the echo $USER script (as is current behavior) it will instead just store $USER inside username. This is probably preferred as $USER should 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.

  • All widgets I've added are correctly documented.
  • I added my changes to CHANGELOG.md, if appropriate.
  • The documentation in the docs/content/main directory has been adjusted to reflect my changes.
  • I used cargo fmt to automatically format all code before committing

fixes issue elkowar#883.
maybe can be casted from a string key of "once" instead for clarity?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FEATURE] Initialize basic variables with shell output
1 participant