Expand description
Widgets: small panels shown beside the monitor, for whatever else someone wants on the same screen. A widget is either built in (a large clock) or fed by any command, which rigtop runs periodically and whose output it renders.
A command prints either plain text (one row per line) or JSON:
{"rows": [
{"label": "5h", "value": "42% · resets 14:30", "gauge": 0.42, "level": "ok"},
{"value": "rigtop", "heading": true},
{"label": "busy", "value": "2 subagents", "level": "warn"}
]}Every field is optional; text is accepted for value. level is one
of normal, dim, ok, warn, bad; gauge is a fraction (0-1)
drawn as a bar, colored from green to red along its length, or in the
row’s level color with "gauge_style": "level" (for amounts left,
where a full bar is good). Commands run on the machine that displays them, through
the shell (sh -c, or cmd /C on Windows).
Structs§
- Command
Runner - Runs a command every interval on its own thread. Dropping it stops the thread after the current run (without waiting for it).
- Widget
- A configured widget, ready to draw.
- Widget
Output - What a command reported.
- Widget
Row - One line of a widget.
- Widget
State - The latest result of a command widget.
Enums§
- Gauge
Style - How a gauge is colored.
- Level
- How a row is colored.
- Widget
Source - Where a widget’s content comes from.
Functions§
- parse_
output - JSON if the output looks like it, else one row per line.
- run_
command - Runs
commandthrough the shell, killing it aftertimeout. Returns its output, or why it failed (the last line of its stderr if any). - start_
widgets - Starts the widgets of the configuration;
notifyis called whenever a command produced new content (to repaint).