A small per-user GNOME Shell extension that shows the remaining Codex 5-hour and weekly limits in the top bar. Its panel text is exactly:
<5-hour remaining>% | <weekly remaining>%
For example, 23% used in the 5-hour window and 66% used in the weekly window
display as 77% | 34%. Each displayed value is rounded to an integer and
clamped to 0–100. An unavailable limit is shown as an em dash without changing
the two-field layout.
codex_usage.pystarts a short-livedcodex app-server --stdioprocess, sends the JSON-RPCinitializeandaccount/rateLimits/readmessages, then prints normalized JSON. It reads no token counts and does not write Codex account or authentication state.extension.jslaunches the helper asynchronously. It refreshes at most once per 60 seconds, on enable, and when the menu opens. It keeps the last successful snapshot if a later request fails.usageModel.jsvalidates normalized data and formats the two panel fields.
The installed Codex 0.153.4 app-server schema was generated and inspected
locally. Its response contains a backwards-compatible rateLimits snapshot
and a rateLimitsByLimitId map. The helper selects the codex entry when
available and identifies its windows by windowDurationMins, not by
primary/secondary position. A live request exposed both 300-minute and
10080-minute windows.
On this laptop, the app-server's default sandbox startup fails because Linux
user namespaces are unavailable in the current environment. The helper passes
a process-only sandbox_mode="danger-full-access" override to let this
read-only account query start. It does not change ~/.codex/config.toml. The
helper sends only the initialization and account rate-limit requests.
- Ubuntu 24.04 with GNOME Shell 46 or a compatible GNOME Shell version.
- A locally authenticated Codex CLI with the app-server interface.
- Python 3 and the GNOME
gjs,gsettings, andgnome-extensionstools. - A user GNOME Shell session. The extension is not installed system-wide.
cd ~/src/codex-usage-indicator
./install.sh installThe command copies the extension to
~/.local/share/gnome-shell/extensions/codex-usage@local/ and enables its ID
in GNOME settings. It does not restart GNOME Shell or log out. A running Shell
may not discover an extension directory created after that Shell session
started. If gnome-extensions info codex-usage@local says the extension does
not exist, it will be loaded at the next GNOME Shell session; the install
script leaves it enabled for that session.
To reinstall after source changes:
cd ~/src/codex-usage-indicator
./install.sh reinstallEnable or disable it with either the project script or GNOME's CLI:
./install.sh enable
./install.sh disable
# Equivalent commands:
gnome-extensions enable codex-usage@local
gnome-extensions disable codex-usage@localRun the live helper directly. On success it prints only normalized usage data; on failure it exits nonzero and prints a concise message to stderr.
./codex_usage.pyThe query timeout can be set for diagnosis, and --codex PATH can select an
explicit executable:
./codex_usage.py --timeout 10
./codex_usage.py --codex /path/to/codexRun the synthetic helper and display-state tests without changing Codex state:
/usr/bin/python3 -m unittest -v
gjs -m tests/test_usage_model.jsInspect GNOME Shell extension logs with:
journalctl --user -b _COMM=gnome-shell --no-pager | grep 'Codex Usage:'- Source:
~/src/codex-usage-indicator/ - Installed extension:
~/.local/share/gnome-shell/extensions/codex-usage@local/ - Helper in the installed extension directory:
codex_usage.py
cd ~/src/codex-usage-indicator
./install.sh uninstallThis disables the extension ID, removes its installed runtime files, and keeps the source directory and Codex CLI data unchanged.
- Ubuntu 24.04.5 LTS (Noble Numbat)
- GNOME Shell 46.0, Wayland session
- Codex CLI 0.153.4 at
~/.local/bin/codex - System Python 3.12.3 at
/usr/bin/python3 - GJS 1.80.2
The Codex helper and synthetic tests were run on these versions. The active GNOME Shell session had already started before this new extension directory was installed and did not rescan it. The extension ID is set to enabled for the next Shell session, but this session did not load the extension, so live panel, menu, and periodic-refresh behavior could not be verified here. No Shell restart or logout was forced.