Skip to content

Commit e75f463

Browse files
committed
Release v0.2.0: provider logos, bar pin mode, Claude OAuth fallback
Three user-facing additions plus two reliability fixes: Pin a provider to the bar Settings now has a 'Show in bar' picker above the provider list with chips for each enabled provider plus Highest. Picking a provider writes ~/.config/codexbar-waybar/state.json and signals waybar via SIGRTMIN+8 so the bar updates within a second. When pinned, the bar shows '🤖 P% • W%' (session • weekly) instead of the cross-provider max. Override per Waybar instance with CODEXBAR_BAR_PROVIDER. Provider logos Mirrors 39 SVG brand marks from upstream CodexBar (MIT, see assets/providers/NOTICE) and renders them next to provider names in both the tab strip and the Settings provider list. Recoloured at load time for the light panel. install.sh drops them under $XDG_DATA_HOME/codexbar-waybar/icons/. Claude OAuth → CLI fallback Anthropic's OAuth rate-limits aggressively. When the primary source returns an error, the wrapper transparently retries with --source cli so the popover never sticks on 'Cached — last refresh failed'. The fallback uses the local Claude CLI logs and yields the same window data. Plus reset-text normalisation end-to-end (both OAuth output like 'May 17 at 6:20AM' and CLI output like 'Resets6:20am(Europe/Paris)' get the missing spaces inserted) and refreshed README screenshots.
1 parent 871af7f commit e75f463

48 files changed

Lines changed: 625 additions & 70 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CHANGELOG.md

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,35 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
## [0.2.0] — 2026-05-17
11+
12+
### Added
13+
- **Provider logos in the popover.** 39 SVG brand marks mirrored from
14+
upstream CodexBar (MIT, see `assets/providers/NOTICE`) are recoloured at
15+
load time and rendered next to provider names in both the tab strip and
16+
the Settings provider list. `install.sh` drops them at
17+
`~/.local/share/codexbar-waybar/icons/`.
18+
- **Pin a provider to the bar.** Settings now has a **Show in bar** picker
19+
above the provider list: chips for each enabled provider plus *Highest*.
20+
Picking a provider writes `~/.config/codexbar-waybar/state.json` and
21+
signals waybar (`SIGRTMIN+8`) so the bar text updates within a second.
22+
When pinned, the bar shows `🤖 P% • W%` (session • weekly) instead of the
23+
cross-provider maximum.
24+
- `CODEXBAR_BAR_PROVIDER` env var to override the pinned provider per Waybar
25+
instance (e.g., one bar per monitor pinned to a different provider).
26+
27+
### Changed
28+
- **Claude OAuth 429s now fall back to `--source cli`** transparently.
29+
Anthropic's rate limits no longer leave the popover stuck on
30+
"Cached — last refresh failed" — the wrapper retries with the local Claude
31+
CLI source and produces fresh data.
32+
- **Reset descriptions are normalised** end-to-end. Both the OAuth output
33+
(`May 17 at 6:20AM`) and the CLI output (`Resets6:20am(Europe/Paris)`) get
34+
the missing spaces inserted, so the popover and tooltip read consistently
35+
in either source.
36+
- README screenshots refreshed to reflect logos, pin mode, and the inline
37+
Settings view.
38+
1039
## [0.1.1] — 2026-05-16
1140

1241
### Changed
@@ -44,6 +73,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
4473
the Waybar entry.
4574
- `install.sh` — idempotent installer.
4675

47-
[Unreleased]: https://github.com/Marouan-chak/codexbar-waybar/compare/v0.1.1...HEAD
76+
[Unreleased]: https://github.com/Marouan-chak/codexbar-waybar/compare/v0.2.0...HEAD
77+
[0.2.0]: https://github.com/Marouan-chak/codexbar-waybar/releases/tag/v0.2.0
4878
[0.1.1]: https://github.com/Marouan-chak/codexbar-waybar/releases/tag/v0.1.1
4979
[0.1.0]: https://github.com/Marouan-chak/codexbar-waybar/releases/tag/v0.1.0

README.md

Lines changed: 90 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -9,25 +9,53 @@
99
surfaces Codex / Claude / Gemini / Copilot / … usage limits and reset windows.
1010
It ships a Linux CLI but no desktop UI for Linux compositors.
1111

12-
This repo bridges that gap:
12+
This repo bridges that gap with two pieces:
1313

14-
- A tiny **Waybar custom module** that polls the `codexbar` CLI and shows the
15-
most-constrained provider as `🤖 27%` with state classes for styling.
16-
- A **GTK4 popover** modeled on the macOS menu — provider tab strip, flat
17-
sections, thin progress bars, reset countdowns, credits balance.
14+
- A **Waybar custom module** that polls the `codexbar` CLI and shows usage as
15+
`🤖 5% • 1%` (session • weekly) for a pinned provider, or `🤖 5%` for the
16+
most-constrained one across all enabled providers.
17+
- A **GTK4 popover** modelled on the macOS menu — provider tab strip with
18+
real brand logos, flat sections, thin progress bars, reset countdowns,
19+
credit balances, and an inline Settings view for toggling providers and
20+
picking which one is pinned to the bar.
1821

1922
<p align="center">
20-
<img src="assets/popup.png" alt="codexbar-waybar popover" width="380" />
23+
<img src="assets/popup.png" alt="codexbar-waybar popover with provider logos" width="370" />
24+
</p>
25+
26+
<p align="center">
27+
<img src="assets/bar.png" alt="codexbar-waybar Waybar segment showing session and weekly" width="225" />
2128
</p>
2229

2330
Validated on Arch Linux + Hyprland (HyDE), but should work on any Wayland
2431
compositor with Waybar + gtk4-layer-shell.
2532

33+
## Features
34+
35+
- **Provider logos** in the tab strip and settings rows, sourced from
36+
upstream CodexBar (39 brand marks). Auto-recoloured for light backgrounds;
37+
see [`assets/providers/NOTICE`](assets/providers/NOTICE).
38+
- **Bar pin mode** — choose `Highest` for cross-provider max, or pin a single
39+
provider to show its session and weekly side by side (`🤖 5% • 1%`).
40+
Toggled live from the popover's Settings view, no Save needed.
41+
- **Inline Settings** — flips the popover body to a scrollable provider list
42+
with per-provider switches; macOS-only providers appear in their own
43+
greyed-out section.
44+
- **OAuth → CLI fallback for Claude.** When Anthropic's OAuth endpoint
45+
rate-limits, the wrapper transparently retries via the local Claude CLI
46+
source so the bar never goes blank.
47+
- **Last-good cache** at `~/.cache/codexbar-waybar/last.json`. Transient 429s
48+
or network blips reuse the previous value and surface as `stale` instead of
49+
blanking the bar.
50+
- **Signal-driven refresh** (`pkill -RTMIN+8 waybar`) so a Settings change
51+
reflects on the bar within a second instead of waiting for the next tick.
52+
2653
## Requirements
2754

2855
- The `codexbar` Linux CLI from
2956
[steipete/CodexBar releases](https://github.com/steipete/CodexBar/releases/latest).
30-
- [Waybar](https://github.com/Alexays/Waybar).
57+
- [Waybar](https://github.com/Alexays/Waybar) 0.10+ (needs `signal` support
58+
on custom modules).
3159
- `jq`, `python3`, `python-gobject` (PyGObject), `gtk4`, `gtk4-layer-shell`,
3260
`libadwaita` (optional but harmless).
3361

@@ -60,22 +88,11 @@ install -m 0755 CodexBarCLI ~/.local/bin/codexbar
6088
codexbar --help
6189
```
6290

63-
Then configure providers in `~/.codexbar/config.json`. Minimal Linux-friendly
64-
config:
65-
66-
```json
67-
{
68-
"providers": [
69-
{ "id": "codex", "enabled": true },
70-
{ "id": "claude", "enabled": true },
71-
{ "id": "gemini", "enabled": true }
72-
],
73-
"version": 1
74-
}
75-
```
76-
7791
Make sure you've already signed in via the providers' own CLIs (`codex login`,
7892
`claude /login`, `gcloud auth application-default login` for Gemini, etc.).
93+
The CLI bootstraps a `~/.codexbar/config.json` with Codex enabled by default
94+
the first time it runs; use the popover's Settings view to toggle Claude,
95+
Gemini, or anything else on without hand-editing JSON.
7996

8097
## Install codexbar-waybar
8198

@@ -92,9 +109,10 @@ The installer:
92109
- Copies `codexbar.sh` and `codexbar-popup.py` to `~/.config/waybar/scripts/`.
93110
- Drops `codexbar.jsonc` as `~/.config/waybar/modules/custom-codexbar.json`.
94111
- Appends `codexbar.css` to `~/.config/waybar/user-style.css` (idempotent).
112+
- Installs provider SVGs to `~/.local/share/codexbar-waybar/icons/`.
95113

96-
The one manual step is wiring `custom/codexbar` into your `config.jsonc`. For a
97-
hand-curated config, add it to a `modules-right` group:
114+
The one manual step is wiring `custom/codexbar` into your `config.jsonc`. For
115+
a hand-curated config, add it to a `modules-right` group:
98116

99117
```jsonc
100118
"group/pill#right1": {
@@ -106,10 +124,20 @@ Reload Waybar (`Ctrl+Alt+W` on HyDE, or `pkill waybar; waybar &`).
106124

107125
## Usage
108126

109-
- **Left-click** the `🤖 nn%` icon → opens the popover (clicking again closes
110-
it).
127+
- **Left-click** the `🤖 %` segment → opens the popover (click again to
128+
close).
111129
- **Right-click**`notify-send` summary, no GUI.
112-
- **Tab strip** in the popover lets you switch between providers.
130+
- **Tab strip** in the popover switches the active provider's card.
131+
- **Settings → Show in bar** picks which provider the bar pins to, or
132+
reverts to `Highest`. Selection writes
133+
`~/.config/codexbar-waybar/state.json` and signals waybar immediately.
134+
- **Settings → Providers** toggles which providers feed the bar and popover.
135+
*Save* writes `~/.codexbar/config.json` and triggers a refresh.
136+
137+
<p align="center">
138+
<img src="assets/settings.png" alt="codexbar-waybar inline settings view" width="395" />
139+
</p>
140+
113141
- **ESC** or the `` button closes the popover.
114142

115143
## Tuning
@@ -120,37 +148,41 @@ definition or your shell profile.
120148
| Variable | Default | Purpose |
121149
| --- | --- | --- |
122150
| `CODEXBAR_BIN` | `~/.local/bin/codexbar` | Path to the CLI binary. |
123-
| `CODEXBAR_STAGGER` | `0.5` | Seconds between provider fetches (raises this if Claude OAuth keeps 429-ing). |
124-
| `CODEXBAR_PROVIDERS` | from config.json | Space-separated provider IDs to query, bypassing `~/.codexbar/config.json`. Set per-Waybar instance if you want different provider sets per monitor. |
125-
| `XDG_CACHE_HOME` | `~/.cache` | Where `last.json` snapshots live. |
151+
| `CODEXBAR_STAGGER` | `0.5` | Seconds between provider fetches (raise it if Claude OAuth keeps 429-ing). |
152+
| `CODEXBAR_PROVIDERS` | from `config.json` | Space-separated provider IDs to query, bypassing `~/.codexbar/config.json`. Set per-Waybar instance if you want different sets per monitor. |
153+
| `CODEXBAR_BAR_PROVIDER` | from `state.json` | Pin a specific provider's session/weekly to the bar regardless of state. Set to a provider ID, or unset for `Highest`. |
126154
| `CODEXBAR_LAYER_SHELL_LIB` | auto-detected | Override path to `libgtk4-layer-shell.so` if your distro stashes it somewhere unusual. |
155+
| `XDG_CACHE_HOME` | `~/.cache` | Where `last.json` snapshots live. |
156+
| `XDG_DATA_HOME` | `~/.local/share` | Where provider icons live (under `codexbar-waybar/icons/`). |
127157

128158
To change which providers appear, open the popover and click **Settings…**
129159
the inline view lets you toggle providers and Save back to
130-
`~/.codexbar/config.json`. The wrapper script picks up the new list on the
131-
next refresh (the popover nudges Waybar to refresh immediately via
132-
`SIGRTMIN+8`). Codex and Claude need `--source oauth` on Linux; the wrapper
133-
sets that automatically via `SOURCE_OVERRIDES` at the top of `codexbar.sh`.
160+
`~/.codexbar/config.json`. Codex and Claude need `--source oauth` on Linux;
161+
the wrapper sets that automatically via `SOURCE_OVERRIDES` at the top of
162+
`codexbar.sh` and falls back to `--source cli` on errors where the CLI source
163+
is available (currently: Claude).
134164

135165
## How it works
136166

137-
1. Waybar runs `codexbar.sh` every 60 s.
138-
2. The script invokes `codexbar usage --provider <p> --format json` once per
139-
enabled provider, sequentially, with a small stagger to dodge per-provider
140-
rate limits.
167+
1. Waybar runs `codexbar.sh` every 30 s (or whenever it receives
168+
`SIGRTMIN+8`).
169+
2. The script reads `~/.codexbar/config.json` to learn which providers are
170+
enabled, then invokes `codexbar usage --provider <p> --format json` once
171+
per enabled provider, sequentially, with a small stagger.
141172
3. Each response is the same JSON payload the macOS menu-bar app consumes:
142173
primary / secondary / tertiary usage windows, reset timestamps, credit
143-
balances, error info.
144-
4. The shell wrapper collapses that into Waybar's JSON contract
145-
`{"text", "tooltip", "class", "percentage"}` keyed on the highest
146-
`usedPercent`.
174+
balances, error info. Claude OAuth 429s trigger a transparent retry via
175+
`--source cli` so the bar keeps working off the local Claude CLI logs.
176+
4. The wrapper collapses the merged payload into Waybar's JSON contract
177+
`{"text", "tooltip", "class", "percentage"}`. The `text` field honours
178+
`~/.config/codexbar-waybar/state.json` (pinned provider) or falls back to
179+
the highest `usedPercent` across all responses.
147180
5. The latest successful per-provider response is cached at
148-
`~/.cache/codexbar-waybar/last.json`. The popover paints from the cache for
149-
an instant first frame, then refetches in the background.
150-
151-
The popup itself is a GTK4 + `gtk4-layer-shell` window anchored to the top-right
152-
of the focused output, with all rendering done in pure CSS — no extra widget
153-
frameworks.
181+
`~/.cache/codexbar-waybar/last.json`. The popover paints from the cache
182+
for an instant first frame and then refetches in the background.
183+
6. The popover is a GTK4 + `gtk4-layer-shell` window anchored to the
184+
top-right of the focused output. SVG provider logos are mirrored from
185+
upstream CodexBar (MIT) and recoloured at load time for the light panel.
154186

155187
## States and styling
156188

@@ -171,21 +203,23 @@ The Waybar module emits one of these classes; style them in
171203
| `libxml2.so.2: cannot open shared object file` | Install your distro's libxml2 v2.13 compat (`libxml2-legacy` on Arch). |
172204
| Module text is blank | Run `~/.config/waybar/scripts/codexbar.sh` directly — it should print one JSON line. |
173205
| Popover never shows | Run `~/.config/waybar/scripts/codexbar-popup.py` from a terminal; check the warnings. The most common one is `gtk4-layer-shell` not preloading — set `CODEXBAR_LAYER_SHELL_LIB`. |
174-
| `HTTP 429 rate_limit_error` from Claude | Raise `CODEXBAR_STAGGER=1.0` and the module `interval` to 120. |
175-
| Tabs render dark / unreadable | You're probably running an old version that fought Adwaita. Pull latest and reinstall. |
206+
| `HTTP 429 rate_limit_error` from Claude | The wrapper already falls back to the local Claude CLI source. If you still see persistent errors, raise `CODEXBAR_STAGGER=1.0` and the module `interval` to 60. |
207+
| Provider logos look like blank squares | Re-run `./install.sh` to refresh `~/.local/share/codexbar-waybar/icons/`. |
208+
| Bar pin doesn't update instantly | Make sure your Waybar module def has `"signal": 8` (the bundled `codexbar.jsonc` already does). |
176209

177210
## Roadmap
178211

179-
- Auto-dismiss on outside click (today: ESC, ``, or click the bar icon).
212+
- Auto-dismiss the popover on outside click (today: ESC, ``, or clicking the
213+
bar icon).
180214
- Dark-mode palette (auto-detect from `gsettings color-scheme` or HyDE
181215
wallbash).
182216
- AUR `PKGBUILD` for one-shot install on Arch.
183217
- Optional Quickshell variant for compositors without Waybar.
184218

185219
## Related
186220

187-
- [CodexBar](https://github.com/steipete/CodexBar) — the upstream macOS app and
188-
Linux CLI this project wraps.
221+
- [CodexBar](https://github.com/steipete/CodexBar) — the upstream macOS app
222+
and Linux CLI this project wraps.
189223
- [Win-CodexBar](https://github.com/Finesssee/Win-CodexBar) — Windows port of
190224
the macOS app.
191225

@@ -198,4 +232,7 @@ itself belongs in the
198232

199233
## License
200234

201-
MIT. See [LICENSE](LICENSE).
235+
MIT. See [LICENSE](LICENSE). Provider SVG marks are redistributed from
236+
upstream CodexBar under the same MIT license (see
237+
[`assets/providers/NOTICE`](assets/providers/NOTICE)); the individual brand
238+
marks remain the property of their respective owners.

assets/bar.png

3.92 KB
Loading

assets/popup.png

-16.7 KB
Loading

assets/providers/NOTICE

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
Provider icon SVGs in this directory are copied verbatim from CodexBar
2+
(https://github.com/steipete/CodexBar) and used here under the same MIT
3+
license:
4+
5+
MIT License
6+
7+
Copyright (c) 2026 Peter Steinberger
8+
9+
Permission is hereby granted, free of charge, to any person obtaining a
10+
copy of this software and associated documentation files (the
11+
"Software"), to deal in the Software without restriction, including
12+
without limitation the rights to use, copy, modify, merge, publish,
13+
distribute, sublicense, and/or sell copies of the Software, and to
14+
permit persons to whom the Software is furnished to do so, subject to
15+
the following conditions:
16+
17+
The above copyright notice and this permission notice shall be included
18+
in all copies or substantial portions of the Software.
19+
20+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
21+
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
23+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
24+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
25+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
26+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27+
28+
Individual brand marks (Anthropic, OpenAI, Google, Microsoft, etc.) remain
29+
the property of their respective owners and are used here under nominative
30+
fair use to identify the corresponding provider.
Lines changed: 18 additions & 0 deletions
Loading
Lines changed: 3 additions & 0 deletions
Loading
Lines changed: 6 additions & 0 deletions
Loading
Lines changed: 3 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)