Repository navigation
Conversation
|
Reviewed by Opus 5 in Claude Code with an independent second opinion from Codex at xhigh reasoning. Tests ran on a disposable Omarchy VM with a real compositor, never on a stub of one: The aggregate change is right and it does fix #10244. Replaying the exact T480 numbers from that issue against a stubbed UPower gives One real defect, found by Codex and then reproduced by running the script: the sysfs sum replaced UPower's rate as soon as any pack yielded a reading, so a pack whose 0W is below the 0.2W idle threshold at line 113, which feeds Pushed Two things left for the maintainer rather than for you. There is a competing pull request, #10392, doing the same thing more conservatively: it switches to Second, a composition hazard worth knowing about: #10377 adds Nothing else found. Note that this does not touch #10344 in either of its two parts — you did not claim it did, and the threshold precedence it describes is #9612's territory. |
omarchy-battery-status picked the first BAT device, so dual-battery laptops reported BAT0 while the bar icon used DisplayDevice. Prefer DisplayDevice for percentage/state/time/size and sum live sysfs power across every BAT. Fall back to the first BAT when DisplayDevice is absent. Fixes #10244 Signed-off-by: fresh3nough <anonwurcod@proton.me>
The sum replaced UPower's rate as soon as any one pack yielded a sysfs reading, so a pack whose native-path does not resolve under /sys/class/power_supply silently dropped out of the total. On a dual-pack machine charging at 45W with the internal pack idle at power_now=0, that reported 0W -- and 0W is below the 0.2W idle threshold, so the panel labelled a charging machine "Holding at 75-80%". Take the sum only when every enumerated pack contributed. A lagging total is wrong by seconds; a subtotal is wrong about what the machine is doing. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Co-Authored-By: Codex XHigh <noreply@openai.com>
Some drivers report native-path as a full /sys/devices path. Joining that string onto power_supply_path never finds the node, so the pack drops out of the live wattage sum and the earlier all-or-nothing guard falls back to a lagging DisplayDevice rate. Always take the basename so bare and absolute forms both resolve under OMARCHY_POWER_SUPPLY_PATH. Also keep battery_info as an alias of the primary pack. Concurrent work that still reads that name for design/health keys otherwise composes cleanly and then silently emits nothing. Signed-off-by: fresh3nough <anonwurcod@proton.me>
d0a067d to
8cf7ac1
Compare
|
Follow-up on the review notes in #10384 (comment). Rebased onto current What changed:
Tests:
Commit is DCO-signed ( |
|
Automated duplication check: this pull request looks similar to #10392, which covers the same battery-status multi-battery aggregation. I keep that one open and close this one to consolidate review. If you feel this is the wrong decision, please open the PR again with a note on the difference. |
Summary
Fixes #10244.
omarchy-battery-statusselected the firstBAT*device fromupower -e. On dual-battery laptops that is usually a full, idle internal pack while the removable pack drains, so the power panel percentage disagreed with the bar icon (which already reads UPower's combinedDisplayDevice).The script now prefers
DisplayDevicefor percentage, state, remaining time, and capacity, sums live sysfs power across every BAT, and still reads charge thresholds / cycle count from the first physical battery. IfDisplayDeviceis missing it falls back to the first BAT.Test plan
bash test/shell.d/battery-status-test.shupower -i .../DisplayDevicepercentage 98%/fully-chargedfrom BAT0Notes
Charge-threshold detection still uses the primary BAT's UPower/sysfs threshold fields; those are not published on DisplayDevice.