Skip to content

Add weekly menubar limit preference#466

Open
Whiteknight07 wants to merge 1 commit into
robinebers:mainfrom
Whiteknight07:feat/weekly-menubar-limit
Open

Add weekly menubar limit preference#466
Whiteknight07 wants to merge 1 commit into
robinebers:mainfrom
Whiteknight07:feat/weekly-menubar-limit

Conversation

@Whiteknight07
Copy link
Copy Markdown

@Whiteknight07 Whiteknight07 commented May 13, 2026

Description

Adds a global setting to prefer weekly limits in the menubar when a provider exposes a weekly overview progress line.

This keeps the current primary metric behavior by default. When enabled, providers like Claude and Codex can show their weekly usage in the menubar instead of the shorter session/window metric.

Related Issue

Fixes #393

Type of Change

  • Bug fix
  • New feature
  • New provider plugin
  • Documentation
  • Performance improvement
  • Other (describe below)

Testing

  • I ran bun run build and it succeeded
  • I ran bun run test and all tests pass
  • I tested the change locally with bun tauri dev

Test results:

  • bun run test: 60 files passed, 1083 tests passed
  • bun run build: passed
  • bun tauri dev: launched locally and setting worked in manual testing

Screenshots

View screenshots

Before:

Before: Menubar Icon settings without weekly preference

After, unchecked:

After: weekly preference visible, unchecked

After, checked:

After: weekly preference visible, checked

Checklist

  • I read CONTRIBUTING.md
  • My PR targets the main branch
  • I did not introduce new dependencies without justification

Summary by cubic

Adds a “Prefer weekly limits” menubar setting that, when enabled, shows weekly usage for providers that expose a weekly overview line (e.g., Claude, Codex). Default is off; existing primary metric behavior remains unchanged. Fixes #393.

  • New Features
    • Settings: Added checkbox “Prefer weekly limits when available” under Menubar Icon; persisted as preferMenubarWeeklyLimit (default false).
    • Tray: Updated getTrayPrimaryBars to prefer weekly overview lines when enabled and fall back to primary candidates otherwise; menubar icon, provider view, and tooltip respect the setting.
    • App wiring: Preference loads at boot, saves on change, and updates the tray preview immediately.

Written for commit 8b0b27a. Summary will update on new commits.

Copilot AI review requested due to automatic review settings May 13, 2026 16:04
@github-actions github-actions Bot added the core label May 13, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new global preference that, when enabled, makes the menubar/tray primary usage metric prefer a provider’s weekly overview progress line (when available), while preserving the current default behavior.

Changes:

  • Added a persisted app preference (preferMenubarWeeklyLimit) with load/save plumbing and bootstrap hydration.
  • Updated tray primary progress selection logic to prefer a “weekly” overview progress line when the preference is enabled.
  • Extended Settings UI and updated affected hooks/tests to wire the preference through to tray rendering.

Reviewed changes

Copilot reviewed 16 out of 16 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/stores/app-preferences-store.ts Adds preferMenubarWeeklyLimit to the app preferences zustand store and exposes a setter.
src/pages/settings.tsx Adds a new checkbox in Menubar Icon settings to toggle weekly preference.
src/pages/settings.test.tsx Adds a UI test verifying the new checkbox triggers the change handler.
src/lib/tray-primary-progress.ts Adds preferWeeklyLimit option and weekly-overview selection logic before primaryCandidates fallback.
src/lib/tray-primary-progress.test.ts Adds tests for “prefer weekly” behavior and fallback when weekly isn’t available.
src/lib/settings.ts Adds storage key + default + load/save functions for the new preference.
src/lib/settings.test.ts Adds unit tests for loading default/stored value and saving the preference.
src/hooks/app/use-tray-icon.ts Threads the preference into tray preview/provider bars/tooltip bar calculations via getTrayPrimaryBars.
src/hooks/app/use-settings-display-actions.ts Adds handler to update store, schedule tray refresh, and persist the preference.
src/hooks/app/use-settings-display-actions.test.ts Extends hook tests to cover saving/logging behavior for the new preference.
src/hooks/app/use-settings-bootstrap.ts Loads preference during bootstrap and hydrates it into the app preference store.
src/hooks/app/use-settings-bootstrap.test.ts Adds coverage for successful load and fallback-to-default on load failure.
src/components/app/app-content.tsx Passes the preference and its change handler through to SettingsPage.
src/components/app/app-content.test.tsx Updates test props to include the new settings handler/preview props.
src/App.tsx Wires the preference from the store into tray icon hook and settings action handlers.
src/App.test.tsx Updates settings module mocks to include load/save for the new preference.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 16 files

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Global setting to prefer weekly limits in menubar when available

2 participants