Repository navigation
Conversation
omarchy-battery-status read whichever pack `upower -e` enumerated first, so a laptop with two of them reported one. On a ThinkPad with an internal cell and a hot-swap slice the power panel showed BAT0's 5% and 22Wh while the machine was actually at 11% of 46Wh with 15 minutes left — and the panel's own progress bar, which reads UPower's composite device, drew the 11%. Text and bar disagreed on the same surface. Take the headline figures from UPower's DisplayDevice, which is the composite of every pack, and sum the instantaneous draw across all of them. Charge thresholds still come off an individual pack; the composite device does not carry them. Cycle counts are reported per pack, because packs wear at their own pace and there is no honest way to collapse two counts into one number. The status command also emits each pack behind numbered keys, and the panel breaks the composite down into a Batteries section when there is more than one. Single-battery machines are unchanged: one entry means no section, and an older status command that emits no entries at all is handled the same way. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013k1Ygomw5M3d5SPbbnqUzs
|
Closing this as a duplicate — #6845 covers the same ground and covers it better. I wrote this before scanning the open PRs properly. There are nine of us on this bug, and #6845 is the one with maintainer commits on it and with #7182, #7295 and #7917 already closed in its favour. For anyone triaging the field later, the two places this PR is concretely worse than #6845, both on the script side:
One thing that may still be worth taking from here, though not from this PR as written: for the panel half, #8904 reads per-pack data from Verified on a ThinkPad X280 with two live packs (BAT0 22.96Wh / BAT1 23.79Wh) if a data point for that configuration is useful to #6845; most of the reports on this bug involve a dead pack rather than two working ones. |
The bug
omarchy-battery-statuspicks its battery withupower -e | grep BAT | head -n 1, so on a machine with two packs it reports one. ThinkPads with an internal cell plus a hot-swap slice are the common case.On my X280 the power panel read 5% · 22Wh · cycles 6 · 0W · no time left while the machine was actually at 11% of 46Wh, drawing 20W, 15 minutes from empty — the internal pack happened to enumerate first and happened to be idle.
The panel contradicted itself on the same surface, too: the hero percentage comes from this command, but the progress bar under it reads
UPower.displayDevice, which is already the composite. The text said 5% next to a bar drawn at 11%.The fix
Take the headline figures from UPower's
DisplayDevice— the composite of every pack, which UPower already maintains and which the bar icon and the low-battery service were using all along — and sum the instantaneous sysfs draw across all packs rather than reading one.Two details do not come from the composite:
DisplayDevicedoes not carry them, so they are still read from a real battery (falling back to sysfs as before).6 · 12). Packs wear at their own pace and there is no honest way to collapse two counts into one number.Showing both
The status command now also emits each pack behind numbered keys (
batteries,battery.1.name,battery.1.percentage, …), and the power panel breaks the composite down into aBATTERIESsection when there is more than one:Single-battery machines are untouched: one entry means no section, so the panel looks exactly as it does today. An older
omarchy-battery-statusthat emits no entries at all is handled the same way, so a half-updated tree degrades rather than breaks.See also
#9106
Verification
test/shell.d/battery-status-test.sh— the existing single-battery scenario is unchanged and still passes; a new two-battery scenario stubsupowerwithBAT0/BAT1/DisplayDeviceand asserts the composite figures, the joined cycle counts, the thresholds staying off the composite device, and every per-pack key.test/shell.d/power-test.sh—Model.batteryListparsing, fraction clamping, the empty case, and the panel bindings../test/shelland./test/clipass. Six shell files fail on this machine both with and without the change (bar-icon-geometry,config,snapper,theme-install-guards,unowned-system-paths,windows-vm-mount-boundary); they are environment checks against an unlinked checkout, not regressions here.