Skip to content

Commit b949b35

Browse files
committed
fix(codexbar): update antigravity reporting
CodexBar 0.32.5 falls through to the Antigravity OAuth path on Linux, which fails unless Antigravity.app or ANTIGRAVITY_OAUTH_CLIENT_ID/SECRET is available. CodexBar 0.40.0 supports the current agy CLI source and returns real Antigravity quota windows. The Waybar wrapper forces antigravity to source=cli so it does not reuse the old ~/.gemini/oauth_creds.json bridge. That bridge can produce stale remote OAuth behavior or placeholder 0/0 quota output instead of the local agy quota summary. A freshly started agy server can answer before RetrieveUserQuotaSummary is ready. The placeholder shape has no extraRateWindows and both primary/secondary usedPercent at 0, so the wrapper waits and retries twice before accepting it. This keeps the workaround documented for a later upstream patch.
1 parent 2f2226e commit b949b35

2 files changed

Lines changed: 38 additions & 16 deletions

File tree

packages/codexbar-cli/package.nix

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,22 +15,24 @@
1515
}:
1616

1717
let
18+
version = "0.40.0";
19+
1820
sources = {
1921
x86_64-linux = {
20-
url = "https://github.com/steipete/CodexBar/releases/download/v0.32.5/CodexBarCLI-v0.32.5-linux-x86_64.tar.gz";
21-
hash = "sha256-oFO+QfaqqWeBe8swpplw7VYphcCnj9t6CA+9422Wv2I=";
22+
url = "https://github.com/steipete/CodexBar/releases/download/v${version}/CodexBarCLI-v${version}-linux-x86_64.tar.gz";
23+
hash = "sha256-QI6eSz3LhkQHR6ootmrPfTincIrg8u/0vOpwgw8CjCk=";
2224
};
2325
aarch64-linux = {
24-
url = "https://github.com/steipete/CodexBar/releases/download/v0.32.5/CodexBarCLI-v0.32.5-linux-aarch64.tar.gz";
25-
hash = "sha256-6wtwbr+pR9YZM00N2zId+UjA6qMn0c+ls9cw6vkS7Ak=";
26+
url = "https://github.com/steipete/CodexBar/releases/download/v${version}/CodexBarCLI-v${version}-linux-aarch64.tar.gz";
27+
hash = "sha256-gZi/3fYbgzv5I0EZWPulxXmMTFppsCiiavvdZmRTRjg=";
2628
};
2729
aarch64-darwin = {
28-
url = "https://github.com/steipete/CodexBar/releases/download/v0.32.5/CodexBarCLI-v0.32.5-macos-arm64.tar.gz";
29-
hash = "sha256-4zN1x1tgwXc9w0ayFtiDLsudlDG50dtGbQRjwJg89kQ=";
30+
url = "https://github.com/steipete/CodexBar/releases/download/v${version}/CodexBarCLI-v${version}-macos-arm64.tar.gz";
31+
hash = "sha256-GEU1Nh+890//oocNHKw5Ew7GPi/SrKc/041SE7vUwl8=";
3032
};
3133
x86_64-darwin = {
32-
url = "https://github.com/steipete/CodexBar/releases/download/v0.32.5/CodexBarCLI-v0.32.5-macos-x86_64.tar.gz";
33-
hash = "sha256-JEZ9GmRpPUvucXLXQDec6cIa4UFFoT0+1d7q5HRJbpw=";
34+
url = "https://github.com/steipete/CodexBar/releases/download/v${version}/CodexBarCLI-v${version}-macos-x86_64.tar.gz";
35+
hash = "sha256-a/mab/Dge//4Wgo51SHOdNMZ/JqTdJy2HfXuqHrhwyU=";
3436
};
3537
};
3638

@@ -40,7 +42,7 @@ let
4042
in
4143
stdenv.mkDerivation {
4244
pname = "codexbar-cli";
43-
version = "0.32.5";
45+
inherit version;
4446

4547
src = fetchzip (source // { stripRoot = false; });
4648

packages/codexbar-waybar/package.nix

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
}:
2525

2626
let
27+
iconSearch = "ICONS_DIR = Path(\n os.environ.get(\"XDG_DATA_HOME\", str(Path.home() / \".local/share\"))\n) / \"codexbar-waybar\" / \"icons\"";
28+
iconReplacement = "ICONS_DIR = Path(os.environ.get(\n \"CODEXBAR_ICONS_DIR\",\n str(Path(os.environ.get(\"XDG_DATA_HOME\", str(Path.home() / \".local/share\"))) / \"codexbar-waybar\" / \"icons\"),\n))";
2729
pythonEnv = python3.withPackages (
2830
pythonPackages: with pythonPackages; [
2931
pycairo
@@ -46,13 +48,31 @@ stdenvNoCC.mkDerivation {
4648
nativeBuildInputs = [ makeWrapper ];
4749

4850
postPatch = ''
49-
substituteInPlace codexbar-popup.py \
50-
--replace-fail 'ICONS_DIR = Path(
51-
os.environ.get("XDG_DATA_HOME", str(Path.home() / ".local/share"))
52-
) / "codexbar-waybar" / "icons"' 'ICONS_DIR = Path(os.environ.get(
53-
"CODEXBAR_ICONS_DIR",
54-
str(Path(os.environ.get("XDG_DATA_HOME", str(Path.home() / ".local/share"))) / "codexbar-waybar" / "icons"),
55-
))'
51+
substituteInPlace codexbar-popup.py \
52+
--replace-fail ${lib.escapeShellArg iconSearch} ${lib.escapeShellArg iconReplacement}
53+
54+
substituteInPlace codexbar.sh \
55+
--replace-fail ' [claude]=oauth' ' [claude]=oauth
56+
[antigravity]=cli' \
57+
--replace-fail ' echo "$body"
58+
}' ' # A freshly started agy server can answer before RetrieveUserQuotaSummary is
59+
# ready. CodexBar then falls back to placeholder model quotas (0/0, no
60+
# extraRateWindows), which makes Waybar look healthy while hiding weekly
61+
# Antigravity usage. Give the CLI source two readiness retries.
62+
if [[ "$p" == "antigravity" ]]; then
63+
for _ in 1 2; do
64+
if echo "$body" | jq -e "type == \"array\" and (.[0].error // null) == null and (.[0].usage.extraRateWindows // null) == null and ((.[0].usage.primary.usedPercent // 0) == 0) and ((.[0].usage.secondary.usedPercent // 0) == 0)" >/dev/null 2>&1; then
65+
sleep "''${CODEXBAR_ANTIGRAVITY_RETRY_DELAY:-5}"
66+
body="$(fetch_one "$p" "$primary")"
67+
else
68+
break
69+
fi
70+
done
71+
fi
72+
73+
echo "$body"
74+
}'
75+
5676
'';
5777

5878
installPhase = ''

0 commit comments

Comments
 (0)