Skip to content

Conversation

@stolot0mt0m
Copy link

@stolot0mt0m stolot0mt0m commented Jan 28, 2026

Summary

This PR adds a native macOS WidgetKit widget extension that displays Claude usage data with Apple-style circular progress rings.

Features

  • Small Widget: Shows 5-hour limit with percentage and reset time
  • Medium Widget: Shows up to 3 usage rings (5h, 7d, Sonnet) with percentages and reset times
  • Apple-style Design: Circular progress rings with text labels in center
  • Dark/Light Theme Support: Adaptive background and colors for both themes
  • Color-coded Progress: Matches main app's color scheme
  • Auto-refresh: Widget updates every 15 minutes

Widget Display

Limit Type Center Label Color Scheme
5-Hour 5h Green → Orange → Red
7-Day 7d Light Purple → Deep Purple → Magenta
Sonnet S Light Blue → Blue → Indigo

Technical Details

New Files

  • Usage4ClaudeWidget/ - Widget extension target
    • Usage4ClaudeWidget.swift - Main widget with TimelineProvider and views
    • Usage4ClaudeWidgetBundle.swift - Widget bundle entry point
    • Usage4ClaudeWidget.entitlements - Widget entitlements
    • SharedUsageData.swift - Widget-only data model

Data Sharing

  • Uses file-based storage via ~/.Usage4Claude/SharedUsageData.json
  • Main app writes data on refresh, widget reads on timeline update
  • No App Groups required for local development

Modified Files

  • Usage4Claude/Shared/SharedUsageData.swift - Shared data model with file-based storage
  • Usage4Claude.entitlements - Updated entitlements
  • project.pbxproj - Added Widget extension target

Requirements

  • macOS 14.0+ for widget extension
  • Apple Developer account for WidgetKit signing (for Widget Gallery)

Test Plan

  • Build and run main app
  • Verify widget appears in widget gallery (requires signing)
  • Add Small widget to desktop - shows 5h ring with % and reset time
  • Add Medium widget to desktop - shows 3 rings with % and reset times
  • Verify data syncs from main app to widget
  • Verify colors match main app's color scheme
  • Test Dark and Light theme appearance
  • Verify widget refreshes automatically

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
@stolot0mt0m stolot0mt0m force-pushed the feature/widget-extension branch from 8e035ac to b88c7be Compare January 28, 2026 12:25
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
@stolot0mt0m stolot0mt0m force-pushed the feature/widget-extension branch from b88c7be to 6bd134b Compare January 28, 2026 12:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant