ii/bar: add AI provider quota widget - #3594
Open
kristianvast wants to merge 2 commits into
Open
Conversation
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.
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.
Adds an optional ii-bar widget that shows quota usage for Codex (OpenAI) and Claude, backed by the CodexBar CLI.
What
services/AiQuota.qmlsingleton pollscodexbar --format jsonevery 5 minutes and normalizes provider data.modules/ii/bar/AiQuotaBar.qmlrenders the real OpenAI and Claude brand icons, tinted by threshold, with stacked icon-over-percent layout in the vertical bar.Config.options.bar.aiQuota.enableandintervalMinutes.Files
services/AiQuota.qmlmodules/ii/bar/AiQuotaBar.qmlassets/icons/claude-symbolic.svg(reuses existingopenai-symbolic.svg)BarContent.qml,VerticalBarContent.qml, and defaults inConfig.qmlNotes
codexbaron PATH (AUR/Homebrew/tarball). If it is missing or a provider errors, the widget degrades gracefully.