AI provider usage in your Waybar β and a macOS-style popover when you click it.
CodexBar is a macOS menu-bar app that surfaces Codex / Claude / Gemini / Copilot / β¦ usage limits and reset windows. It ships a Linux CLI but no desktop UI for Linux compositors.
This repo bridges that gap with two pieces:
- A Waybar custom module that polls the
codexbarCLI and shows usage asπ€ 5% β’ 1%(session β’ weekly) for a pinned provider, orπ€ 5%for the most-constrained one across all enabled providers. - A GTK4 popover modelled on the macOS menu β provider tab strip with real brand logos, flat sections, thin progress bars, reset countdowns, credit balances, and an inline Settings view for toggling providers and picking which one is pinned to the bar.
Validated on Arch Linux + Hyprland (HyDE), but should work on any Wayland compositor with Waybar + gtk4-layer-shell.
- Provider logos in the tab strip and settings rows, sourced from
upstream CodexBar (39 brand marks). Auto-recoloured for light backgrounds;
see
assets/providers/NOTICE. - Bar pin mode β choose
Highestfor cross-provider max, or pin a single provider to show its session and weekly side by side (π€ 5% β’ 1%). Toggled live from the popover's Settings view, no Save needed. - Inline Settings β flips the popover body to a scrollable provider list with per-provider switches; macOS-only providers appear in their own greyed-out section.
- OAuth β CLI fallback for Claude. When Anthropic's OAuth endpoint rate-limits, the wrapper transparently retries via the local Claude CLI source so the bar never goes blank.
- Last-good cache at
~/.cache/codexbar-waybar/last.json. Transient 429s or network blips reuse the previous value and surface asstaleinstead of blanking the bar. - Signal-driven refresh (
pkill -RTMIN+8 waybar) so a Settings change reflects on the bar within a second instead of waiting for the next tick.
- The
codexbarLinux CLI from steipete/CodexBar releases. - Waybar 0.10+ (needs
signalsupport on custom modules). jq,python3,python-gobject(PyGObject),gtk4,gtk4-layer-shell,libadwaita(optional but harmless).
sudo pacman -S waybar jq python-gobject gtk4 gtk4-layer-shell libadwaitalibxml2 gotcha: Arch currently ships
libxml2.so.16(2.15+); the CodexBar Linux tarball links againstlibxml2.so.2. Install the compat package:sudo pacman -S libxml2-legacy
sudo apt install waybar jq python3-gi gir1.2-gtk-4.0 gir1.2-gtk4layershell-1.0curl -LO https://github.com/steipete/CodexBar/releases/latest/download/CodexBarCLI-vX-linux-x86_64.tar.gz
tar -xzf CodexBarCLI-vX-linux-x86_64.tar.gz
install -m 0755 CodexBarCLI ~/.local/bin/codexbar
codexbar --helpMake sure you've already signed in via the providers' own CLIs (codex login,
claude /login, gcloud auth application-default login for Gemini, etc.).
The CLI bootstraps a ~/.codexbar/config.json with Codex enabled by default
the first time it runs; use the popover's Settings view to toggle Claude,
Gemini, or anything else on without hand-editing JSON.
Clone and run the installer:
git clone https://github.com/Marouan-chak/codexbar-waybar.git
cd codexbar-waybar
./install.shThe installer:
- Copies
codexbar.shandcodexbar-popup.pyto~/.config/waybar/scripts/. - Drops
codexbar.jsoncas~/.config/waybar/modules/custom-codexbar.json. - Appends
codexbar.cssto~/.config/waybar/user-style.css(idempotent). - Installs provider SVGs to
~/.local/share/codexbar-waybar/icons/.
The one manual step is wiring custom/codexbar into your config.jsonc. For
a hand-curated config, add it to a modules-right group:
Reload Waybar (Ctrl+Alt+W on HyDE, or pkill waybar; waybar &).
- Left-click the
π€ β¦%segment β opens the popover (click again to close). - Right-click β
notify-sendsummary, no GUI. - Tab strip in the popover switches the active provider's card.
- Settings β Show in bar picks which provider the bar pins to, or
reverts to
Highest. Selection writes~/.config/codexbar-waybar/state.jsonand signals waybar immediately. - Settings β Providers toggles which providers feed the bar and popover.
Save writes
~/.codexbar/config.jsonand triggers a refresh.
- ESC or the
βbutton closes the popover.
Each knob is an environment variable; set it inside the Waybar module definition or your shell profile.
| Variable | Default | Purpose |
|---|---|---|
CODEXBAR_BIN |
~/.local/bin/codexbar |
Path to the CLI binary. |
CODEXBAR_STAGGER |
0.5 |
Seconds between provider fetches (raise it if Claude OAuth keeps 429-ing). |
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. |
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. |
CODEXBAR_LAYER_SHELL_LIB |
auto-detected | Override path to libgtk4-layer-shell.so if your distro stashes it somewhere unusual. |
XDG_CACHE_HOME |
~/.cache |
Where last.json snapshots live. |
XDG_DATA_HOME |
~/.local/share |
Where provider icons live (under codexbar-waybar/icons/). |
To change which providers appear, open the popover and click Settingsβ¦ β
the inline view lets you toggle providers and Save back to
~/.codexbar/config.json. Codex and Claude need --source oauth on Linux;
the wrapper sets that automatically via SOURCE_OVERRIDES at the top of
codexbar.sh and falls back to --source cli on errors where the CLI source
is available (currently: Claude).
- Waybar runs
codexbar.shevery 30 s (or whenever it receivesSIGRTMIN+8). - The script reads
~/.codexbar/config.jsonto learn which providers are enabled, then invokescodexbar usage --provider <p> --format jsononce per enabled provider, sequentially, with a small stagger. - Each response is the same JSON payload the macOS menu-bar app consumes:
primary / secondary / tertiary usage windows, reset timestamps, credit
balances, error info. Claude OAuth 429s trigger a transparent retry via
--source cliso the bar keeps working off the local Claude CLI logs. - The wrapper collapses the merged payload into Waybar's JSON contract
{"text", "tooltip", "class", "percentage"}. Thetextfield honours~/.config/codexbar-waybar/state.json(pinned provider) or falls back to the highestusedPercentacross all responses. - The latest successful per-provider response is cached at
~/.cache/codexbar-waybar/last.json. The popover paints from the cache for an instant first frame and then refetches in the background. - The popover is a GTK4 +
gtk4-layer-shellwindow anchored to the top-right of the focused output. SVG provider logos are mirrored from upstream CodexBar (MIT) and recoloured at load time for the light panel.
The Waybar module emits one of these classes; style them in
~/.config/waybar/user-style.css:
| Class | Meaning |
|---|---|
ok |
0 β€ percentage < 70 |
warning |
70 β€ percentage < 90 |
critical |
percentage β₯ 90 |
stale |
All providers errored, or any value came from cache |
| Symptom | Likely fix |
|---|---|
libxml2.so.2: cannot open shared object file |
Install your distro's libxml2 v2.13 compat (libxml2-legacy on Arch). |
| Module text is blank | Run ~/.config/waybar/scripts/codexbar.sh directly β it should print one JSON line. |
| 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. |
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. |
| Provider logos look like blank squares | Re-run ./install.sh to refresh ~/.local/share/codexbar-waybar/icons/. |
| Bar pin doesn't update instantly | Make sure your Waybar module def has "signal": 8 (the bundled codexbar.jsonc already does). |
- Auto-dismiss the popover on outside click (today: ESC,
β, or clicking the bar icon). - Dark-mode palette (auto-detect from
gsettings color-schemeor HyDE wallbash). - AUR
PKGBUILDfor one-shot install on Arch. - Optional Quickshell variant for compositors without Waybar.
- CodexBar β the upstream macOS app and Linux CLI this project wraps.
- Win-CodexBar β Windows port of the macOS app.
PRs and issues welcome β see CONTRIBUTING.md. Bug reports
go through the GitHub issue templates; anything about the codexbar CLI
itself belongs in the
upstream tracker instead.
MIT. See LICENSE. Provider SVG marks are redistributed from
upstream CodexBar under the same MIT license (see
assets/providers/NOTICE); the individual brand
marks remain the property of their respective owners.


