Skip to content

ii/bar: add AI provider quota widget - #3594

Open
kristianvast wants to merge 2 commits into
end-4:mainfrom
kristianvast:feat/ai-quota-bar-widget
Open

ii/bar: add AI provider quota widget#3594
kristianvast wants to merge 2 commits into
end-4:mainfrom
kristianvast:feat/ai-quota-bar-widget

Conversation

@kristianvast

Copy link
Copy Markdown

Adds an optional ii-bar widget that shows quota usage for Codex (OpenAI) and Claude, backed by the CodexBar CLI.

What

  • New services/AiQuota.qml singleton polls codexbar --format json every 5 minutes and normalizes provider data.
  • New modules/ii/bar/AiQuotaBar.qml renders the real OpenAI and Claude brand icons, tinted by threshold, with stacked icon-over-percent layout in the vertical bar.
  • Hover popup shows session/weekly/monthly usage, reset countdowns, pace projections, credits, and provider errors.
  • Config defaults: Config.options.bar.aiQuota.enable and intervalMinutes.

Files

  • services/AiQuota.qml
  • modules/ii/bar/AiQuotaBar.qml
  • assets/icons/claude-symbolic.svg (reuses existing openai-symbolic.svg)
  • Registrations in BarContent.qml, VerticalBarContent.qml, and defaults in Config.qml

Notes

  • Requires codexbar on PATH (AUR/Homebrew/tarball). If it is missing or a provider errors, the widget degrades gracefully.
  • Polling uses a login shell plus an in-flight guard so it keeps working across session restarts without overlapping fetches.
  • Verified live on Arch/Hyprland with the ii vertical bar.

Adds a new AiQuota service and AiQuotaBar widget that show Codex and
Claude quota usage in the ii bar. The widget polls codexbar CLI every
five minutes, renders the real OpenAI and Claude brand icons tinted by
threshold, and exposes session/weekly/monthly usage, reset countdowns,
pace projections, and provider errors in a hover popup.

The widget is registered in both the horizontal and vertical ii bars and
can be disabled through Config.options.bar.aiQuota.enable. Polling uses a
login shell with an in-flight guard so it keeps working across session
restarts without overlapping fetches.
Timer.running defaults to false in QML, so the poll timer never started
and the widget only ever fetched once per shell launch via
Component.onCompleted. Values looked correct right after a restart and
then stayed frozen indefinitely.

Start the timer explicitly and drop the now-redundant one-shot fetch,
since triggeredOnStart covers the initial poll. Also bound the fetch with
timeout(1) so a slow provider probe cannot hold the in-flight guard and
stall later polls, and fall back to a 5 minute interval when the config
entry is absent.
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