Repository navigation
Conversation
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds multi-battery support end-to-end (status collection → shell output → panel rendering) and hardens state/rate reporting by preferring sysfs over potentially stale UPower values.
Changes:
- Aggregate battery metrics across all packs in
omarchy-battery-status, emitting optional per-pack breakdown keys. - Render per-pack battery rows in the power panel when more than one pack is present.
- Extend shell tests to cover stale UPower state vs sysfs, holding logic, and multi-battery aggregation/breakdown.
Reviewed changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| test/shell.d/power-test.sh | Adds unit tests for batteryPacks() parsing behavior. |
| test/shell.d/battery-status-test.sh | Adds integration tests for stale UPower state, holding behavior, and multi-pack aggregation/breakdown. |
| shell/plugins/panels/power/Panel.qml | Displays per-pack breakdown rows for multi-battery machines. |
| shell/plugins/panels/power/Model.js | Introduces batteryPacks(info) to extract per-pack rows from shell output. |
| bin/omarchy-battery-status | Aggregates readings across multiple batteries; prefers sysfs for rate/state; emits per-pack keys. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| Repeater { | ||
| model: root.batteryPacks.filter(function (pack, index) { return index % 2 === 0 }) | ||
| InfoPair { label: modelData.label; value: modelData.value } | ||
| } |
| Repeater { | ||
| model: root.batteryPacks.filter(function (pack, index) { return index % 2 === 1 }) | ||
| InfoPair { label: modelData.label; value: modelData.value } | ||
| } |
|
Closing this in favour of the earlier work already in flight — there are four PRs solving the same problem, and that is three more than this needs. Overlapping, in filing order:
Thanks @YuseiRun for cross-linking these. If it is useful to whoever's work lands, two pieces of this one are worth lifting rather than rewriting:
Happy to rebase either onto whichever PR the maintainers prefer — just say which. To be clear about scope: #7293 is a separate fix and stays open. It addresses charge state being read from a stale UPower label rather than sysfs, which is independent of aggregating multiple packs and reproduces on single-battery hardware too. |
Stacked on #7293 — take that one first; this branch contains it.
Laptops with two packs (ThinkPad T480 and friends, internal + hot-swappable) expose one
BAT*device each.omarchy-battery-statustakesupower -e | grep BAT | head -n 1, so the panel describes one pack and ignores the rest. On a T480 the bar reads:That is the idle 16Wh internal pack, with no time estimate, while the 71Wh pack does all the work.
Every reading now combines all packs:
348 / 82); thresholds take the lowest across packsThe panel gains a
Battery 1/Battery 2row showing each pack's size and charge, emitted only when a second pack exists — single-battery machines see the panel exactly as before, and there are tests on both sides asserting that.One expectation moves:
battery status reports remaining timegoes2h 30m→2h 37m. Time no longer comes from UPower'stime to empty(per-pack, and wrong once there are two) and is derived instead, which is consistent with the sysfs rate the script already prefers.Verified on a T480 across both directions:
./test/shellpasses apart from four failures that reproduce unchanged on a pristinequattrocheckout of this machine (bar-icon-geometry,config,snapper,unowned-system-paths).