Skip to content

Add salemsayed/codexbar-meter (CodexBar Meter) - #243

Open
salemsayed wants to merge 1 commit into
noctalia-dev:mainfrom
salemsayed:add-codexbar-meter
Open

Add salemsayed/codexbar-meter (CodexBar Meter)#243
salemsayed wants to merge 1 commit into
noctalia-dev:mainfrom
salemsayed:add-codexbar-meter

Conversation

@salemsayed

@salemsayed salemsayed commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Plugin

  • Id: salemsayed/codexbar-meter
  • New plugin
  • Update to an existing plugin (version bumped in plugin.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 widget (bar) — a compact meter per provider, limited to
    barProviderLimit (default 2) with a +N overflow count. The tooltip lists
    every provider returned.
  • Panel (panel-compact, panel, panel-tall) — one card per provider with
    each 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 is
    run, on the refresh interval and on manual refresh:

    timeout 30s <codexbarPath> usage --format json --json-only

    codexbarPath is a plugin setting (default codexbar) and is shell-quoted
    before 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:bar to the bar; confirmed the meters, the
    +N overflow, 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 refresh and saw
    both surfaces update from the shared state.

  • Exercised each setting: codexbarPath pointed at an absolute path and at a
    wrapper script, refreshIntervalSec at its 30 s floor, and barProviderLimit
    from 1 to 4.

  • Failure paths: a codexbarPath that does not exist, a command returning
    non-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 = 8 is the oldest level this plugin requires: level 8 introduced the
dismiss_on_outside_click panel 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.formatTime is called without a timezone
argument (level 19).

Screenshots / Videos

The plugin running on Niri — the bar meters at the top right, and the
panel-tall tier listing both providers:

CodexBar Meter panel and bar widget

The account identity in this screenshot is a placeholder; the plugin renders
whatever CodexBar reports.

Checklist

  • The directory name matches the part of id after the / in plugin.toml exactly.
  • It ships plugin.toml, README.md, thumbnail.webp, and translations/en.json.
  • README.md follows the
    README template, documents
    every entry id and dependency, and includes exact panel IPC commands and launcher prefixes where applicable.
  • I created thumbnail.webp with the thumbnail generator.
  • version follows semver and is bumped in this PR; plugin_api is the oldest API level this plugin requires.
  • Every non-English translation in this PR uses a locale supported by Noctalia core, and I can read, write, and
    understand that language well enough to review and maintain it (no unreviewed machine/LLM translations).
  • I did not edit catalog.toml; CI generates it.
  • This PR touches exactly one plugin directory.

This PR ships translations/en.json only, so the translation item is satisfied
by having no other locales to vouch for.

Code review attestation

Plugins run as trusted, unsandboxed Luau in the user's session. Confirm:

  • The code is readable and not obfuscated, minified, or generated.
  • It does not download and execute remote code.
  • Every network call, filesystem write, and spawned process is something the description above accounts for.
  • I have the right to publish this code under the license declared in plugin.toml.

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant