Repository navigation
Conversation
Adds a reusable `blinking` property to WidgetButton (drives a looping opacity pulse without fighting the existing opacity binding) and wires it up alongside the existing `active`/`activeColor` mechanism on the power panel's bar icon, keyed off a new isBatteryLow() check in Model.js. Threshold matches the existing omarchy-battery-low notification (10%, discharging).
There was a problem hiding this comment.
Pull request overview
Adds a visual low-battery warning to the Quickshell bar.
Changes:
- Adds reusable blinking support to
WidgetButton. - Turns the battery indicator urgent-colored and blinking at low charge.
- Adds low-battery model and wiring tests.
Tip
If you aren't ready for review, convert to a draft PR.
Click "Convert to draft" or run gh pr ready --undo.
Click "Ready for review" or run gh pr ready to reengage.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
shell/Ui/WidgetButton.qml |
Adds opacity pulsing support. |
shell/plugins/panels/power/Panel.qml |
Activates the warning state at low battery. |
shell/plugins/panels/power/Model.js |
Determines whether battery charge is low. |
test/shell.d/power-test.sh |
Tests low-battery logic and panel wiring. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
isBatteryLow() compared the raw percentage fraction against the threshold while the omarchy-battery-low notification rounds first, so a level like 10.4% triggered the notification but left the bar icon uncolored. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01R9toPoRnj7WKNtKhVZDMcr
The pulse animated a blinkOpacity property that fed into the item's opacity, but bar text/glyphs render with Text.NativeRendering, which doesn't composite with an animated ancestor opacity — only color changes are drawn. The color did flip (active/urgent), so the red tint showed but the pulse never did. Verified live: before the fix, captured frames a full period apart were pixel-identical; after, they visibly alternate. Drive the pulse through the drawn color's alpha instead, via a shared blinkedColor() helper (reusing Util.alpha() rather than reimplementing it) that both the label Text and BarIconButton's icon glyph call. Also apply blinkOpacity directly to BarIconButton's iconComponent Loader, since Loader-hosted content isn't NativeRendering text and still composites opacity normally, and disable the label's color Behavior while blinking so it doesn't fight the per-frame pulse. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01R9toPoRnj7WKNtKhVZDMcr
The bar indicator is a persistent visual, not a one-shot warning, so give it a lower bar than the omarchy-battery-low notification (10%) and reserve it for the final stretch before shutdown. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01R9toPoRnj7WKNtKhVZDMcr
A single red+blinking state didn't give enough warning before shutdown. Escalate through three thresholds while discharging: 10% turns the bar icon yellow (matching the existing omarchy-battery-low notification threshold), 5% turns it red, and 2% adds the blink — lining up with UPower's own PercentageCritical (5) and PercentageAction (2) defaults, the point at which the system forces a suspend/hibernate. Adds a warning semantic color (from the theme's yellow/color3, alongside the existing urgent/red) since the bar had no non-red "pay attention" tint. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01R9toPoRnj7WKNtKhVZDMcr
The warning notification otherwise lingers for its full 30s timeout even after the user has already acted on it. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01R9toPoRnj7WKNtKhVZDMcr
isBatteryLow() additionally required device.state === Discharging, a stricter condition than root.discharging (isPresent && onBattery) used everywhere else in Panel.qml. device.state can lag onBattery by a poll cycle right after a plug event (already covered by the "stale discharging state" test above), so the three battery tiers could stay uncolored for a beat while the rest of the panel already read as on-battery. Drop the state check and trust onBattery, like the rest of the panel does. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01R9toPoRnj7WKNtKhVZDMcr
The low-battery toast's title was hardcoded independently in both bin/omarchy-battery-low (send) and Service.qml (dismiss on plug-in), with nothing tying them together — an edit to one would silently break the dismiss without any test catching it. Cross-reference them in comments and assert the two strings match. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01R9toPoRnj7WKNtKhVZDMcr
Resolve two conflicts with upstream's no-animations mode, which wrapped the same animation durations this branch edited in Style.duration(): - WidgetButton.qml: keep the !root.blinking guard on the label's color Behavior and take the Style.duration(160) duration. - Bar.qml: take Style.duration(420) on the existing Behaviors and apply it to the Behavior on warning this branch adds. Also hold the low-battery blink still under Style.reduceMotion, the way upstream's other looping pulses and spinners do. The critical tier still shows in the urgent color; it just does not animate. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
…oast Address the two review findings on the low-battery indicator: - A power widget cloned with `omarchy plugin clone omarchy.power` gets a PluginBarApi rather than the host bar, and that facade had no `warning` color, so the clone could not show the yellow tier. Add the property and mirror it from the bar like `urgent`. - Plugging in while the low-battery notification was still being sent let the dismiss run before the toast existed, leaving it up for its full timeout. Dismiss again once the send finishes if the charger is in, and queue a dismiss requested while one is already in flight instead of dropping it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Resolve one conflict in shell/plugins/bar/Bar.qml: upstream switched the bar color Behaviors from Easing.InOutCubic to Easing.OutCubic on the same lines where this branch adds a Behavior on warning. Take OutCubic on the existing Behaviors and apply it to the warning one so all four bar colors ease the same way. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A dismiss queued while another was in flight replayed unconditionally, so unplugging before it ran took down the new low-battery warning. Drop the queued dismiss on unplug and replay it only while still on AC. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Summary
Adds a three-tier visual low-battery indicator to the Quickshell bar, escalating as charge drops while discharging:
omarchy-battery-lownotification threshold)PercentageCriticaldefaultPercentageActiondefault, the point where the system forces a suspend/hibernateEach tier is a superset of the next (danger implies warning, critical implies both), so the bar only ever shows its reddest active tier.
Also:
blinkingproperty toWidgetButton, pulsing the drawn color's alpha (not the item'sopacity— bar text/glyphs render withText.NativeRendering, which doesn't composite with an animated ancestor opacity, so an opacity-driven pulse silently never showed on screen; verified live, before/after, by diffing captured frames a full animation period apart).warningsemantic color (from the theme'syellow/color3, alongside the existingurgent/red) since the bar previously had no non-red "pay attention" tint.Addresses long-standing requests for a visual low-battery indicator (#1502, #3066, #1798, #1213, discussions #2343, #4473). A prior attempt at colored battery icons (#2808) was closed for scope/quality reasons on the old waybar setup; this targets the current Quickshell-based bar and reuses its existing semantic-color plumbing instead of hardcoding colors per theme.
Test plan
test/shell.d/power-test.sh— unit tests forisBatteryLow()at all three thresholds, plus regex checks on the Panel.qml wiringtest/shell.d/battery-test.sh— regex checks on the plug-in dismiss wiring./test/shell— full suite green aside from 4 pre-existing, unrelated failures