Skip to content

Commit 9d3be62

Browse files
committed
docs: percentage/alt + signal no waybar-contract
1 parent 5ef1cf7 commit 9d3be62

1 file changed

Lines changed: 57 additions & 0 deletions

File tree

docs/waybar-contract.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,34 @@ starts its login flow when it is disconnected. See
5353
[commands.md → Internal Commands](commands.md#internal-commands-waybar-triggered)
5454
for the `action-right` branch logic.
5555

56+
### Signal (On-Demand Refresh)
57+
58+
Set `"signal": <N>` under `waybar` in `~/.config/agent-bar/settings.json`
59+
(`N` between 1 and 30) to add `signal: N` to every generated module. Waybar then
60+
re-runs the module when it receives `SIGRTMIN+N`. **Off by default** (no `signal`
61+
key in the module unless set), so there is no collision risk out of the box.
62+
63+
The module's `exec` is unchanged (`agent-bar --provider <provider>`), which reads
64+
the 5-minute quota cache — so a bare signal only re-renders cached data. To force
65+
a **fresh** fetch on demand, invalidate the cache first, then signal:
66+
67+
```bash
68+
agent-bar -p claude -r && pkill -RTMIN+8 waybar
69+
```
70+
71+
Wire that as a Claude Code Stop hook to refresh the bar when a task finishes
72+
(`~/.claude/settings.json`):
73+
74+
```json
75+
{
76+
"hooks": {
77+
"Stop": [
78+
{ "hooks": [{ "type": "command", "command": "agent-bar -p claude -r && pkill -RTMIN+8 waybar" }] }
79+
]
80+
}
81+
}
82+
```
83+
5684
## CSS Export
5785

5886
```bash
@@ -99,6 +127,35 @@ agent-bar
99127
and adds provider-scoped classes such as `claude-ok`, `codex-warn`, or
100128
`amp-critical`.
101129

130+
## Output Fields (`alt` / `percentage`)
131+
132+
Single-provider modules (`--provider <id>`) emit, in addition to `text`,
133+
`tooltip`, and `class`:
134+
135+
- `alt` — the health state (`ok` / `low` / `warn` / `critical` / `disconnected`),
136+
for `format-icons` keyed by state.
137+
- `percentage` — the displayMode-aware quota value (the same number shown in
138+
`text`), for `{percentage}` in `format` or `format-icons` arrays. **Omitted**
139+
when there is no data or the provider is disconnected.
140+
141+
The aggregate module (no `--provider`) does **not** emit `alt`/`percentage`.
142+
143+
Example `format-icons` keyed by state (`alt`) — replace the emoji with your own
144+
glyphs (e.g. Nerd Font):
145+
146+
```jsonc
147+
"custom/agent-bar-claude": {
148+
"format": "{icon} {percentage}%",
149+
"format-icons": {
150+
"ok": "🟢",
151+
"low": "🟡",
152+
"warn": "🟠",
153+
"critical": "🔴",
154+
"disconnected": ""
155+
}
156+
}
157+
```
158+
102159
## Asset Install
103160

104161
```bash

0 commit comments

Comments
 (0)