Add systemSmall (Home Screen) support to the Gauge widget#4741
Conversation
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
This PR adds Home Screen support for the gauge widget by enabling the .systemSmall family and adjusting the widget’s layout so the accessory-style circular gauge scales appropriately inside a small tile.
Changes:
- Add
@Environment(\.widgetFamily)to adapt the view layout per widget family. - Scale the circular gauge for
.systemSmallusingGeometryReader+scaleEffect. - Expand the supported widget families to include
.systemSmall.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| Sources/Extensions/Widgets/Lockscreen/Gauge/WidgetGaugeView.swift | Adds family-aware layout and scaling behavior for .systemSmall. |
| Sources/Extensions/Widgets/Lockscreen/Gauge/WidgetGauge.swift | Registers .systemSmall as a supported widget family. |
008f8d5 to
938623a
Compare
The Gauge widget has only ever offered `.accessoryCircular` (Lock Screen / watch-complication) because it originated as a watchOS-style complication ported to the Lock Screen in home-assistant#2830. Home Screen support was never on the table there, so the limitation is an inheritance, not a design decision. WidgetKit renders gauges in `.systemSmall` fine, and the data path (WidgetGaugeAppIntentTimelineProvider) is family-agnostic, so this is a view-only change: - Add `.systemSmall` to `WidgetGaugeSupportedFamilies.families`. - Branch `WidgetGaugeView` on `\.widgetFamily`: the Lock Screen path is unchanged; `.systemSmall` enlarges the existing gauge to fill a padded square. The container background requirement is already satisfied via the shared `widgetBackground` helper (`containerBackground(_:for:.widget)`). No new strings, no provider/intent changes, no other references to the families list. Lock Screen behavior is byte-for-byte identical. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
938623a to
b7d37d3
Compare
The gauge widget views lived only in Extensions-Widgets, unlike the other widget views (e.g. WidgetBasicContainerView, which is also in App), so they weren't reachable from the snapshot-test target. Add WidgetGaugeView + its entry provider to the App target to match, then add a light/dark systemSmall snapshot test alongside the existing tile snapshots. Reference images were recorded on the iOS 26.5 simulator; the existing tile snapshots pass in the same environment. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Ah, Claude invented that via |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4741 +/- ##
=======================================
Coverage ? 44.96%
=======================================
Files ? 275
Lines ? 16701
Branches ? 0
=======================================
Hits ? 7510
Misses ? 9191
Partials ? 0 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
The .normal and .singleLabel gauge types now draw the tint as a partial arc (0…value) over a dim track — matching Apple's Batteries gauge — instead of tinting the whole ring with a separate dot indicator. This applies on both the Home Screen and the Lock Screen, where the system's vibrant rendering preserves the bright-fill / dim-track band. The .capacity type is unchanged (it already fills natively). Min/max labels are tucked inside the ring so the Lock Screen's circular mask doesn't clip them. Adds snapshot coverage for the single-label, capacity, and accessoryCircular variants, plus #Preview blocks for eyeballing the real Lock Screen rendering. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
bgoncal
left a comment
There was a problem hiding this comment.
While the new design works best for home screen, this PR also change the UI for the lock screen widget, which is not the main goal and should be reverted.
I tested it in Home Screen using plain values and did not see the correct state of the widget. Please double check the implementation and send a screen recording configuring the widget and showing how it looks after configured, including home and lock screen.
Finally the preview is also blank, I see you wrote code to populate it so you may want to check as well.
|
Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍 |
|
Good call, I'll work on splitting the lock screen into a separate PR, since that's new scope, as well as the other changes you laid out. Also I think I have spotted an issue in your screenshot — in the bottom row, left most screen, the Value Template field looks set to More to follow ... |
|
Oh good catch, totally forgot about that, let me know when I can test again. |
Per review, the partial-fill arc is applied only on the Home Screen (.systemSmall). The Lock Screen (.accessoryCircular) returns to the native accessory gauge — changing the Lock Screen is separate scope and will be proposed in its own PR. Also drops the #Preview scaffolding and the accessoryCircular snapshot tests/references that were specific to that work. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
OK lock screen style changes, and preview both removed. And here is my video testing it out ( somewhat clumsily through Remote Desktop and Simulator, apologies in advance ! ): |
|
You mentioned you removed the preview value but what I actually meant was to make the preview work, so users dont see an empty widget when looking at the widget picker, makes sense? Also, the home screen widget is not vertically centered, can you check that? |






Summary
The Gauge widget has only ever offered
.accessoryCircular(Lock Screen / watch-complication) because it originated as a watchOS-style complication ported to the Lock Screen in #2830. Home Screen support was never on the table there, so the limitation is an inheritance, not a design decision.WidgetKit renders gauges in
.systemSmallfine, and the data path (WidgetGaugeAppIntentTimelineProvider) is family-agnostic, so this is a view-only change:.systemSmalltoWidgetGaugeSupportedFamilies.families.WidgetGaugeViewon\.widgetFamily: the Lock Screen path is unchanged;.systemSmallenlarges the existing gauge to fill a padded square. The container background requirement is already satisfied via the sharedwidgetBackgroundhelper (containerBackground(_:for:.widget)).No new strings, no provider/intent changes, no other references to the families list. Lock Screen behavior is byte-for-byte identical.
Screenshots
Link to pull request in Documentation repository
Documentation: home-assistant/companion.home-assistant#1351
Any other notes