Add weekly menubar limit preference#466
Conversation
There was a problem hiding this comment.
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.
|
@codex review |
|
Codex Review: Didn't find any major issues. Another round soon, please! ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
Would need a screenshot to evaluate. Cheers |
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
Testing
bun run buildand it succeededbun run testand all tests passbun tauri devTest results:
bun run test: 60 files passed, 1083 tests passedbun run build: passedbun tauri dev: launched locally and setting worked in manual testingScreenshots
View screenshots
Before:
After, unchecked:
After, checked:
Checklist
mainbranchSummary 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.
preferMenubarWeeklyLimit(defaultfalse).getTrayPrimaryBarsto prefer weekly overview lines when enabled and fall back to primary candidates otherwise; menubar icon, provider view, and tooltip respect the setting.Written for commit 8b0b27a. Summary will update on new commits.