Skip to content

feat: add optional menu-bar reset countdown rings - #62

Open
KurtGood wants to merge 2 commits into
f-is-h:mainfrom
KurtGood:feature/menubar-countdown
Open

feat: add optional menu-bar reset countdown rings#62
KurtGood wants to merge 2 commits into
f-is-h:mainfrom
KurtGood:feature/menubar-countdown

Conversation

@KurtGood

Copy link
Copy Markdown

What this adds

Two reset-countdown rings in the menu bar, interleaved with the existing usage rings so each usage ring is immediately followed by its time ring:

(5h usage)(5h countdown – red)(weekly usage)(7d countdown – orange)

Each time ring fills with the percentage of its window already elapsed — same scale and drawing as the usage rings — so the time ring visibly races its neighbour. If the usage ring is ahead of the time ring, you're spending that window's quota faster than the clock is running it down. The ring's center shows the remaining time in a compact, adaptive unit:

  • 5-hour (red): minutes under an hour, otherwise hours
  • 7-day (orange): hours under a day, otherwise days

Reset edge case: right after a window resets, the API returns no resets_at (the timer only starts on first token use). During that gap the ring shows an empty ring + a full-window placeholder (5h / 7d) instead of vanishing, then transitions to the live countdown once usage starts — so the time ring always stays paired with its usage ring.

Setting + i18n

  • New "Reset countdown" checkbox under General → display settings.
  • Defaulted on. Happy to flip it to opt-in (off by default) if you'd prefer — it's a one-liner in UserSettings.init / resetToDefaults().
  • Localized across all six bundled languages (en, fr, ja, ko, zh-Hans, zh-Hant). The non-English strings are my best effort — please review/adjust.
  • When the toggle is off: timeCircleFor returns nil (no rings drawn), the 30 s repaint timer is stopped, and the countdown text is dropped from the icon cache key (so toggling busts the cache cleanly).

Implementation notes

  • MenuBarIconRenderertimeCircleFor / makeTimeCircle / timeCircleText; a centerText parameter added to the existing circle-drawing helpers so time rings reuse the usage-ring rendering path.
  • UsageData+FormattingmenuBarCountdown text + cache-key contribution.
  • DataRefreshManager — a 30 s menuBarCountdown repaint timer (local repaint only, no network request).
  • MenuBarManager — starts/stops that timer according to the setting.
  • UserSettings / GeneralSettingsView / LocalizationHelper / 6× Localizable.strings — the toggle and its strings.

Rebased on main (v3.2.0). Builds and runs locally on macOS (ad-hoc signed).

🤖 Generated with Claude Code

KurtGood and others added 2 commits July 14, 2026 19:23
Adds an optional pair of reset-countdown rings to the menu bar (5-hour red, 7-day orange) interleaved with the usage rings. Each fills with the percentage of its window elapsed and shows the remaining time in its center, so the time ring races alongside its neighbouring usage ring.

Adds a "Reset countdown" toggle in General settings (on by default), localized in all six supported languages. When off, no time rings are drawn, the 30s repaint timer is stopped, and the countdown text is excluded from the icon cache key.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
German localization landed upstream in v3.3.0 after the countdown
strings were written; backfill de.lproj so German users don't fall
back to English.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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