feat: add macOS WidgetKit widget extension#24
feat: add macOS WidgetKit widget extension#24stolot0mt0m wants to merge 4 commits intof-is-h:mainfrom
Conversation
b88c7be to
6bd134b
Compare
6bd134b to
274b95b
Compare
|
Hey @f-is-h! 👋 I've rebased this PR on the latest I think a native macOS widget would be a great addition to Usage4Claude — here's why:
Would love to hear your thoughts — happy to make adjustments if needed! |
|
Hi, thanks for putting this together! The widget concept is great and I'd love to have it in the app. A few things that need to be addressed before merging:
Let me know if you have any questions! |
274b95b to
115ac29
Compare
|
Hi @f-is-h, thanks for the detailed review! I've addressed all your feedback: 1. pbxproj IDs — Replaced all hand-written IDs ( 2. Main app signing config — Restored 3. App Groups for data sharing — Switched from file-based storage ( 4. Deployment target — One thing to flag: WidgetKit on macOS requires a minimum deployment target of macOS 14.0 (Sonoma). Setting it to 13.0 would cause build errors since Also rebased on the latest |
Add a native macOS widget that displays Claude usage data with Apple-style circular progress rings. Features: - Small and Medium widget sizes - Usage rings for 5h, 7d, Opus, and Sonnet limits - Color-coded progress (green → orange → red based on utilization) - Automatic data sync via App Groups - 15-minute refresh interval New files: - Usage4ClaudeWidget/ - Widget extension target - Usage4Claude/Shared/SharedUsageData.swift - Shared data model Modified files: - DataRefreshManager.swift - Sync data to widget on refresh - project.pbxproj - Widget extension target configuration - Usage4Claude.entitlements - App Groups capability Requirements: - App Group: group.xyz.fi5h.Usage4Claude - macOS 14.0+ for widget extension
Widget improvements: - Small widget: Show only 5h limit with percentage and reset time - Medium widget: Show up to 3 rings (5h, 7d, Sonnet) with reset times - Add text labels in ring center (5h, 7d, S, $) - Add Dark/Light theme support with adaptive background - Match ring colors with main app's color scheme - Remove unused Opus limit case - Add file-based data sharing via ~/.Usage4Claude/SharedUsageData.json
- Replace hand-written pbxproj IDs with proper 24-char hex UUIDs - Restore main app signing config (Manual, Usage4Claude-CodeSigning, sandbox enabled) - Switch from file-based storage (~/.Usage4Claude/) to App Group UserDefaults - Add App Group entitlements to both main app and widget extension - Align MACOSX_DEPLOYMENT_TARGET to 14.0 for both targets (required by WidgetKit) - Match widget signing config to main app style
115ac29 to
f943cce
Compare
|
Hi @f-is-h, just rebased on the latest |
Resolves conflict in project.pbxproj: - Keep MACOSX_DEPLOYMENT_TARGET = 14.0 (required for WidgetKit) - Adopt MARKETING_VERSION = 2.6.1 from upstream
Summary
This PR adds a native macOS WidgetKit widget extension that displays Claude usage data with Apple-style circular progress rings.
Features
Widget Display
5h7dSTechnical Details
New Files
Usage4ClaudeWidget/- Widget extension targetUsage4ClaudeWidget.swift- Main widget with TimelineProvider and viewsUsage4ClaudeWidgetBundle.swift- Widget bundle entry pointUsage4ClaudeWidget.entitlements- Widget entitlements (App Group)SharedUsageData.swift- Widget-only data modelData Sharing
group.xyz.fi5h.Usage4Claude) viaUserDefaults(suiteName:)for sandbox-safe data sharing between app and widgetModified Files
Usage4Claude/Shared/SharedUsageData.swift- Shared data model with App Group storageUsage4Claude/Usage4Claude.entitlements- Added App Group entitlementUsage4Claude/Helpers/DataRefreshManager.swift- Widget sync on data refreshproject.pbxproj- Added Widget extension target (Xcode-style UUIDs)Signing & Sandbox
ENABLE_APP_SANDBOX = YESDeployment Target
Test Plan