Skip to content

Commit 871af7f

Browse files
committed
Release v0.1.1: fresh-install polish
Three fixes surfaced during a from-scratch install walkthrough: - codexbar.sh now reads the enabled-provider list from ~/.codexbar/config.json (with a (codex claude gemini) fallback when the config is missing). Override per-instance with CODEXBAR_PROVIDERS. A Codex-only user no longer sees Claude/Gemini error tabs in the popover. - The module's interval drops from 60s to 30s and declares signal 8 so pkill -RTMIN+8 waybar triggers an immediate refresh. The popover sends that signal right after a Settings Save so the bar reflects the new provider list without waiting for the next tick. - install.sh hard-fails when 'codexbar' is missing from PATH and prints the exact tarball + libxml2-legacy commands inline, instead of leaving the user with a silent half-install. Also fixes codexbar.jsonc click handler that still pointed at notify-send instead of the GTK popover.
1 parent 1de76da commit 871af7f

6 files changed

Lines changed: 73 additions & 29 deletions

File tree

CHANGELOG.md

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,25 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
## [0.1.1] — 2026-05-16
11+
1012
### Changed
11-
- **Settings is now an inline view inside the popover** — no external editor,
12-
no JSON file opened in a browser. Clicking *Settings…* swaps the popup
13-
body to a scrollable provider list with per-provider toggle switches.
14-
*Save* writes back to `~/.codexbar/config.json` and refreshes the data;
15-
*Back* cancels.
16-
- Linux-unsupported providers (macOS-only web/cookie sources) appear in their
17-
own grayed-out section with a "macOS only" hint, so it's obvious why you
18-
can't enable them without trial-and-error.
13+
- **Wrapper script reads enabled providers from `~/.codexbar/config.json`**
14+
instead of hardcoding `(codex claude gemini)`. A Codex-only user no longer
15+
sees Claude/Gemini error tabs. Override per-instance with
16+
`CODEXBAR_PROVIDERS="codex claude"` if you need to bypass the config.
17+
- **Default refresh interval dropped from 60 s to 30 s** and the module now
18+
declares `signal: 8`, so a `pkill -RTMIN+8 waybar` forces an immediate
19+
refresh. The popover sends that signal after a Save so the bar reflects
20+
toggled providers without waiting for the next tick.
21+
- **`install.sh` now hard-fails if the `codexbar` CLI is missing**, with the
22+
exact tarball + libxml2-legacy commands inline. Previous behaviour was a
23+
soft warning that left users with a silent half-install.
24+
- **Inline Settings view** (already in 0.1.1 — moved out of Unreleased):
25+
clicking *Settings…* swaps the popover body to a scrollable provider
26+
list with per-provider toggle switches and a *Save* button. macOS-only
27+
providers appear in a separate grayed section with a hint, so users
28+
don't waste time enabling things that can't work on Linux.
1929

2030
## [0.1.0] — 2026-05-16
2131

@@ -34,5 +44,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
3444
the Waybar entry.
3545
- `install.sh` — idempotent installer.
3646

37-
[Unreleased]: https://github.com/Marouan-chak/codexbar-waybar/compare/v0.1.0...HEAD
47+
[Unreleased]: https://github.com/Marouan-chak/codexbar-waybar/compare/v0.1.1...HEAD
48+
[0.1.1]: https://github.com/Marouan-chak/codexbar-waybar/releases/tag/v0.1.1
3849
[0.1.0]: https://github.com/Marouan-chak/codexbar-waybar/releases/tag/v0.1.0

README.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,12 +121,16 @@ definition or your shell profile.
121121
| --- | --- | --- |
122122
| `CODEXBAR_BIN` | `~/.local/bin/codexbar` | Path to the CLI binary. |
123123
| `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. |
124125
| `XDG_CACHE_HOME` | `~/.cache` | Where `last.json` snapshots live. |
125126
| `CODEXBAR_LAYER_SHELL_LIB` | auto-detected | Override path to `libgtk4-layer-shell.so` if your distro stashes it somewhere unusual. |
126127

127-
To change which providers appear, edit `PROVIDERS=( … )` and `SOURCE_OVERRIDES`
128-
at the top of `codexbar.sh`. Codex and Claude need `--source oauth` on Linux
129-
because their `auto` source tries the (macOS-only) web scrape first.
128+
To change which providers appear, open the popover and click **Settings…**
129+
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`.
130134

131135
## How it works
132136

codexbar-popup.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -510,6 +510,9 @@ def _on_settings_save(self):
510510
self.view = "usage"
511511
self.render()
512512
self.refresh(background=True)
513+
# Nudge waybar so the bar reflects the new provider list without
514+
# waiting for the next interval. The signal is wired up in codexbar.jsonc.
515+
subprocess.Popen(["pkill", "-RTMIN+8", "waybar"])
513516

514517
def refresh(self, *, background: bool):
515518
def worker():

codexbar.jsonc

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,19 @@
1-
// Waybar custom-module definition for CodexBar.
1+
// Waybar custom-module definition for codexbar-waybar.
22
//
3-
// Install:
4-
// install -m 0644 codexbar.jsonc ~/.config/waybar/modules/custom-codexbar.json
3+
// install.sh drops this at ~/.config/waybar/modules/custom-codexbar.json.
4+
// You then reference "custom/codexbar" from a modules-right group in your
5+
// ~/.config/waybar/config.jsonc — see README.md for the snippet.
56
//
6-
// Then reference "custom/codexbar" in one of your modules-right groups
7-
// in ~/.config/waybar/config.jsonc, e.g.:
8-
// "modules-right": ["custom/codexbar", "clock", "battery"]
9-
//
10-
// See docs/linux-waybar.md for the full walkthrough.
7+
// To force a refresh from elsewhere: pkill -RTMIN+8 waybar
118
{
129
"custom/codexbar": {
1310
"exec": "$HOME/.config/waybar/scripts/codexbar.sh",
1411
"return-type": "json",
1512
"format": "{}",
16-
"interval": 60,
17-
"on-click": "bash -c 'notify-send -a CodexBar -t 10000 \"AI usage\" \"$($HOME/.config/waybar/scripts/codexbar.sh | jq -r .tooltip)\"'",
13+
"interval": 30,
14+
"signal": 8,
15+
"on-click": "$HOME/.config/waybar/scripts/codexbar-popup.py",
16+
"on-click-right": "bash -c 'notify-send -a CodexBar -t 8000 \"AI usage\" \"$($HOME/.config/waybar/scripts/codexbar.sh | jq -r .tooltip)\"'",
1817
"tooltip": true,
1918
"max-length": 24
2019
}

codexbar.sh

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,33 @@
66
# Last successful per-provider snapshot is cached, so a transient 429 is masked
77
# until the next refresh recovers it.
88
#
9-
# Linux-only providers used here (cookies/web providers are macOS-only).
10-
# Edit PROVIDERS / SOURCE_OVERRIDES below to add more.
9+
# Linux-only providers — cookies/web providers are macOS-only. The list is
10+
# read from ~/.codexbar/config.json (use the popover's Settings view to
11+
# manage it); falls back to codex+claude+gemini if the file is missing.
1112

1213
set -u
1314

1415
CODEXBAR="${CODEXBAR_BIN:-${HOME}/.local/bin/codexbar}"
16+
CONFIG_PATH="${HOME}/.codexbar/config.json"
1517
CACHE_DIR="${XDG_CACHE_HOME:-${HOME}/.cache}/codexbar-waybar"
1618
mkdir -p "$CACHE_DIR"
1719

18-
# Provider list and per-provider source override.
19-
# Codex/Claude need explicit --source oauth on Linux (auto tries web first).
20-
PROVIDERS=(codex claude gemini)
20+
# Read enabled providers from the codexbar CLI's config, fall back to a
21+
# sensible default if it's missing or unreadable. Override with the
22+
# CODEXBAR_PROVIDERS env var (space-separated list) when you want to bypass
23+
# config.json for a specific waybar instance.
24+
if [[ -n "${CODEXBAR_PROVIDERS:-}" ]]; then
25+
# shellcheck disable=SC2206
26+
PROVIDERS=( ${CODEXBAR_PROVIDERS} )
27+
elif [[ -f "$CONFIG_PATH" ]] && command -v jq >/dev/null 2>&1; then
28+
readarray -t PROVIDERS < <(jq -r '[.providers[]? | select(.enabled == true) | .id] | .[]' "$CONFIG_PATH" 2>/dev/null)
29+
[[ ${#PROVIDERS[@]} -eq 0 ]] && PROVIDERS=(codex claude gemini)
30+
else
31+
PROVIDERS=(codex claude gemini)
32+
fi
33+
34+
# Per-provider --source override. Codex/Claude need explicit oauth on Linux
35+
# (their `auto` falls back to web first, which is macOS-only).
2136
declare -A SOURCE_OVERRIDES=(
2237
[codex]=oauth
2338
[claude]=oauth

install.sh

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,20 @@ yellow() { printf '\033[33m%s\033[0m\n' "$*"; }
2424

2525
# 1. codexbar binary check
2626
if ! command -v codexbar >/dev/null 2>&1; then
27-
yellow "Warning: 'codexbar' is not on PATH."
28-
yellow "Install the Linux CLI before continuing — see README.md for the tarball + libxml2-legacy notes."
27+
red "'codexbar' is not on PATH."
28+
cat <<'EOF' >&2
29+
30+
Install the Linux CLI first:
31+
32+
curl -LO https://github.com/steipete/CodexBar/releases/latest/download/CodexBarCLI-linux-x86_64.tar.gz
33+
tar -xzf CodexBarCLI-linux-x86_64.tar.gz
34+
install -m 0755 CodexBarCLI ~/.local/bin/codexbar
35+
36+
Arch users also need: sudo pacman -S libxml2-legacy
37+
38+
Then re-run this installer.
39+
EOF
40+
exit 1
2941
fi
3042

3143
# 2. Required deps

0 commit comments

Comments
 (0)