forked from external/yambar
module/script: add poll-interval option
When set to a non-negative value, the script module will call the configured script every <poll-interval> second. In this mode, the script is expected to write one tag set and then exit. This is intended to simplify the implementation of scripts that would otherwise just do a loop + sleep. Closes #67
This commit is contained in:
parent
e4a0b375e5
commit
cf41d008f8
3 changed files with 101 additions and 17 deletions
|
@ -8,11 +8,16 @@ script - This module executes a user-provided script (or binary!)
|
|||
This module executes a user-provided script (or binary!) that writes
|
||||
tags on its stdout.
|
||||
|
||||
The script can either exit immediately after writing a set of tags, in
|
||||
which case yambar will display those tags until yambar is
|
||||
terminated. Or, the script can continue executing and update yambar
|
||||
with new tag sets, either periodically, or when there is new data to
|
||||
feed to yambar.
|
||||
Scripts can be run in two modes: yambar polled, or continously. In the
|
||||
yambar polled mode, the script is expected to write one set of tags
|
||||
and then exit. Yambar will execute the script again after a
|
||||
configurable amount of time.
|
||||
|
||||
In continous mode, the script is executed once. It will typically run
|
||||
in a loop, sending an updated tag set whenever it needs, or wants
|
||||
to. The last tag set is used (displayed) by yambar until a new tag set
|
||||
is received. This mode is intended to be used by scripts that depends
|
||||
on non-polling methods to update their state.
|
||||
|
||||
Tag sets, or _transactions_, are separated by an empty line
|
||||
(e.g. *echo ""*). The empty line is required to commit (update) the
|
||||
|
@ -70,6 +75,10 @@ User defined.
|
|||
: list of strings
|
||||
: no
|
||||
: Arguments to pass to the script/binary.
|
||||
| poll-interval
|
||||
: integer
|
||||
: Number of seconds between each script run. If unset, continous mode
|
||||
is used.
|
||||
|
||||
# EXAMPLES
|
||||
|
||||
|
@ -89,8 +98,9 @@ while true; do
|
|||
done
|
||||
```
|
||||
|
||||
This script will emit a single string tag, _test_, and alternate its
|
||||
value between *hello* and *world* every three seconds.
|
||||
This script runs in continous mode, and will emit a single string tag,
|
||||
_test_, and alternate its value between *hello* and *world* every
|
||||
three seconds.
|
||||
|
||||
A corresponding yambar configuration could look like this:
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue