feat: add claudePeakHoursEnabled setting and integrate into UsageMenu…#611
feat: add claudePeakHoursEnabled setting and integrate into UsageMenu…#611hello-amed wants to merge 4 commits intosteipete:mainfrom
Conversation
…CardView and ClaudeProviderImplementation - Introduced `claudePeakHoursEnabled` property in SettingsStore and SettingsStoreState. - Updated UsageMenuCardView to utilize the new setting for displaying peak hours status. - Added toggle for peak hours visibility in ClaudeProviderImplementation. - Ensured persistence of the setting in user defaults.
There was a problem hiding this comment.
Pull request overview
Adds a user-facing setting to control whether Claude “peak hours” status is shown, wires it through settings persistence, provider settings UI, and the usage menu card, and introduces a core formatter + tests for determining peak/off-peak status.
Changes:
- Added
claudePeakHoursEnabledtoSettingsStorestate, defaults loading, andUserDefaultspersistence. - Introduced
ClaudePeakHours(CodexBarCore) with weekday/ET peak-window calculations plus dedicated unit tests. - Integrated the setting into the Claude provider settings toggles and
UsageMenuCardViewnote rendering.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| Tests/CodexBarTests/ClaudePeakHoursTests.swift | Adds unit tests covering peak/off-peak labeling and timing boundaries. |
| Sources/CodexBarCore/Providers/Claude/ClaudePeakHours.swift | Implements peak-hours window logic and duration formatting. |
| Sources/CodexBar/StatusItemController+Menu.swift | Passes the new setting into the usage menu card model input. |
| Sources/CodexBar/SettingsStoreState.swift | Extends defaults state to include claudePeakHoursEnabled. |
| Sources/CodexBar/SettingsStore.swift | Loads claudePeakHoursEnabled from UserDefaults (defaulting to true). |
| Sources/CodexBar/SettingsStore+Defaults.swift | Adds computed property for reading/writing the setting to UserDefaults. |
| Sources/CodexBar/Providers/Claude/ClaudeProviderImplementation.swift | Adds a provider settings toggle bound to claudePeakHoursEnabled. |
| Sources/CodexBar/MenuCardView.swift | Extends model input and shows the peak-hours label in usageNotes when enabled. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Updated `claudePeakHoursEnabled` to default to true in the UsageMenuCardView model. - Added tests to verify peak hours note visibility when the setting is enabled and disabled.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 09a4420c39
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
Add peak hours indicator for Claude
Shows whether Claude is currently in peak or off-peak usage hours directly in the menu card. During peak hours (8 AM–2 PM ET, weekdays), usage counts more heavily against plan limits — this helps users decide when to schedule heavier work.
What it does
Screenshots
Changes
ClaudePeakHours.swift— determines peak/off-peak status and formats the countdownMenuCardView.swift— shows the note for Claude when the setting is enabledSettingsStore,SettingsStoreState, andClaudeProviderImplementationfor the toggleClaudePeakHoursTests.swift— 14 tests covering weekday boundaries, weekends, and Friday→Monday transitionsContext
Anthropic recently changed how usage limits work during peak hours — sessions burn faster during 8 AM–2 PM ET on weekdays. This was announced as a capacity management change, not a temporary promo. More info:
https://x.com/trq212/status/2037254607001559305?s=46&t=zaM0WGXRKL-GqGy6eWj_1A
https://support.claude.com/en/articles/14063676