Fix/claude permanent firefox#35
Conversation
Claude Desktop is Electron+Chromium and stores claude.ai cookies in the same encrypted SQLite format Chrome does, under the macOS Keychain entry service="Claude Safe Storage", account="Claude Key". Because the desktop app renews sessionKey whenever you use Claude, this source basically never goes stale — no manual re-login needed like the Firefox path. - New scripts/claude-plan-usage-desktop.py reads the cookie DB, decrypts via PBKDF2/AES-CBC, and hits the same claude.ai/api/.../usage endpoint as the Firefox script. Falls through to the Firefox script automatically when Keychain access fails or no sessionKey is present. - LaunchAgent + install.sh now point at the desktop script as primary. - CLAUDE.md updated to document both sources and the new triage steps for Keychain access issues. - pycryptodome added to requirements.txt for the AES decrypt. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Display: - iOS label "% remaining" -> "% used" to match claude.ai's framing - Bar now fills as you consume; color is green<50% used, orange<80%, red>=80% - usedPct = 100 - sessionPct/weeklyPct, computed on the iOS side, no protocol change so firmware/daemon contract stays the same. Refresh cadence: - Chrome plan scrape LaunchAgent StartInterval: 60s -> 15s - Claude daemon CODEXMETER_POLL_INTERVAL: 30s -> 10s (env in plist) - iOS fetchTimer: 30s -> 15s - Worst-case lag from claude.ai change to phone display drops from ~2 min to ~40s. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
The widget was rendering the raw sessionPct/weeklyPct payload fields, which are "remaining %" — so when the main app showed "61% used" the widget showed "39% left." Same data, opposite framing. User couldn't tell at a glance that they were synced. - New helpers usedPct(from:) and usedColor(forUsed:) convert the on-the-wire remaining% to displayed used%. - AtomProgressBar now fills LEFT-to-RIGHT as the user consumes; color goes green -> orange (>=50% used) -> red (>=80% used). - Atom-style widget labels switch from "X LEFT" / "WK LEFT" to "5H USED" / "7D USED" and show the inverted percentage. - Accessory circular and rectangular variants display used% too. - Bumped widget timeline reload from 15 min to 5 min so iOS gets a more aggressive refresh hint (the app already calls WidgetCenter.reloadAllTimelines on every fetch, but the timeline policy bounds how patient iOS is). The protocol fields (s/w) still carry remaining%; only the widget's display layer changed. Firmware contract is untouched. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Lets the user pick whether percentages are shown as "X% used" (fills as you consume, matches claude.ai — default) or "X% left" (drains as you consume, the original behavior). - Settings screen gets a new "Display > Percentages" segmented picker. - Stored as display_framing in sharedGroup so both the main app and the widget read the same value. - Bar color stays keyed on usage pressure (red when heavily used) regardless of framing, so visual urgency doesn't invert. - WidgetCenter.reloadAllTimelines() is called on toggle so the home screen picks up the new framing. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1b2b98ec69
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
|
||
| // Session (Today) | ||
| Text(entry.isOk ? "\(formatResetTime(mins: entry.sessionResetMins).uppercased()) LEFT" : "TODAY") | ||
| Text(entry.isOk ? "5H \(DisplayFraming.current.suffix)" : "TODAY") |
There was a problem hiding this comment.
Keep widget window labels aligned with active provider
These labels are now hard-coded to 5H/7D for every successful entry, but AtomWidgetStyleView renders both Claude and Codex payloads. When the source is Codex, the widget still shows a 5-hour/7-day framing even though Codex session usage is daily, so the timeframe context presented to users is incorrect despite valid percentages. Please keep provider-specific labels (or derive them from the payload/reset window) instead of forcing Claude-specific text.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Summary
- Implemented provider-specific widget window labels in
UsageWidget.swiftso Claude continues to show5H/7D, while Codex now showsTODAY/WEEK, preventing incorrect timeframe framing on Codex payloads. - Replaced hardcoded timeframe text in
AtomWidgetStyleViewwith the new helper functions at both session and weekly label callsites. - Committed the change as:
Fix widget window labels by provider(commit81a5e57).
Testing
- ✅
cd /workspace/CodexMeter && git diff -- ios/CodexMeterApp/CodexMeterAppWidget/UsageWidget.swift - ✅
cd /workspace/CodexMeter && rg -n "sessionWindowLabel|weeklyWindowLabel|5H|7D|TODAY|WEEK" ios/CodexMeterApp/CodexMeterAppWidget/UsageWidget.swift - ✅
cd /workspace/CodexMeter && git commit -m "Fix widget window labels by provider"
Description
Related Issue
Type of Change
Testing
pio run -e m5stack_atoms3ruff check .pytest -qScreenshots
Checklist