Add salemsayed/codexbar-meter (CodexBar Meter) - #243
Open
salemsayed wants to merge 1 commit into
Open
Conversation
A bar widget and attached panel showing AI provider usage limits reported by the local CodexBar CLI. The bar keeps a configurable number of provider meters; the panel lists every provider, quota window, credit balance, and pace summary, and scrolls when the response is taller than the panel. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BCNAY79YEoNxyubdt8Co9A
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Plugin
salemsayed/codexbar-meterplugin.toml)What it does
Shows how much of your AI provider quota is left, without leaving the bar.
CodexBar is a local CLI that reads usage
from the AI providers you have signed in to. This plugin renders what it reports:
bar) — a compact meter per provider, limited tobarProviderLimit(default 2) with a+Noverflow count. The tooltip listsevery provider returned.
panel-compact,panel,panel-tall) — one card per provider witheach quota window, its percentage, and when it resets, plus credits, CodexBar's
pace summary ("on pace", "runs out in 2d 11h"), provider status, and stale-data
warnings. The widget picks the tier that fits the current payload; every tier
scrolls, so an unusually large response is never truncated.
Providers come from CodexBar's own enabled-provider list rather than a hardcoded
set, so a provider CodexBar adds later shows up without a change here. Unknown
providers get a readable title, a neutral icon, and a theme-derived color.
A provider-level error stays as a card next to healthy providers, and a refresh
that returns no usable JSON leaves the last good response on screen with a
warning rather than blanking the widget.
External dependencies
codexbar— the only process this plugin spawns. Exactly one command isrun, on the refresh interval and on manual refresh:
codexbarPathis a plugin setting (defaultcodexbar) and is shell-quotedbefore use. Nothing else is executed, and no argument is derived from the
command's own output.
timeout— GNU coreutils, used solely for the 30-second bound above.CodexBar owns provider authentication, credential storage, and all network
access. The plugin never reads credentials and never contacts a provider itself.
Beyond that single command the plugin makes no network calls and writes no
files. State is kept in Noctalia's plugin state so the bar widget and panel
share one payload instead of querying twice.
One privacy note for reviewers: the panel renders the account identity CodexBar
reports for a provider, which for some providers is the signed-in email address.
It is displayed only, never stored or transmitted. This is documented in the
README's Notes section.
Testing
Run against a live CodexBar 0.47.0 with two providers signed in (Codex via OAuth,
Claude), on Noctalia v5.0.0 under Niri.
Added
salemsayed/codexbar-meter:barto the bar; confirmed the meters, the+Noverflow, and the tooltip listing all providers.Opened all three panel tiers by IPC and by clicking the widget, and confirmed
the widget selects a tier from the payload and that each tier scrolls.
Right-click refresh and the panel's refresh button both trigger a new query;
the close button dismisses the panel.
Sent
noctalia msg plugin salemsayed/codexbar-meter:bar all refreshand sawboth surfaces update from the shared state.
Exercised each setting:
codexbarPathpointed at an absolute path and at awrapper script,
refreshIntervalSecat its 30 s floor, andbarProviderLimitfrom 1 to 4.
Failure paths: a
codexbarPaththat does not exist, a command returningnon-JSON, and a partial response with one provider erroring. The bar keeps the
last good data and surfaces the error rather than going blank.
Tested on Niri
Tested on Hyprland
Tested on Sway
Tested on another compositor:
Noctalia version tested against: v5.0.0 (856d99bbd199)
Plugin API level: 8
plugin_api = 8is the oldest level this plugin requires: level 8 introduced thedismiss_on_outside_clickpanel entry option, which all three panel entries use.Nothing here reaches past it — panel callbacks are string names rather than
inline closures (level 9), and
noctalia.formatTimeis called without a timezoneargument (level 19).
Screenshots / Videos
The plugin running on Niri — the bar meters at the top right, and the
panel-talltier listing both providers:The account identity in this screenshot is a placeholder; the plugin renders
whatever CodexBar reports.
Checklist
idafter the/inplugin.tomlexactly.plugin.toml,README.md,thumbnail.webp, andtranslations/en.json.README.mdfollows theREADME template, documents
every entry id and dependency, and includes exact panel IPC commands and launcher prefixes where applicable.
thumbnail.webpwith the thumbnail generator.versionfollows semver and is bumped in this PR;plugin_apiis the oldest API level this plugin requires.understand that language well enough to review and maintain it (no unreviewed machine/LLM translations).
catalog.toml; CI generates it.This PR ships
translations/en.jsononly, so the translation item is satisfiedby having no other locales to vouch for.
Code review attestation
Plugins run as trusted, unsandboxed Luau in the user's session. Confirm:
licensedeclared inplugin.toml.