Repository navigation
Conversation
…ry laptops battery-status picked the first battery device alphabetically (upower -e | grep BAT | head -n 1), which on dual-battery ThinkPads (e.g. T480 with an internal + hot-swap bay battery) only reports one battery's percentage/capacity/cycles while ignoring the other entirely. This visibly disagreed with the power panel's progress bar and icon, which already correctly bind to UPower's composite DisplayDevice (Quickshell.Services.UPower's UPower.displayDevice) -- so the panel showed a percentage number and a bar that told two different stories. Point the script at the same DisplayDevice object instead, and check its "present" state (mirroring the QML's isPresent check) rather than relying on the now-removed enumerate step to signal "no battery". Verified on a ThinkPad T480 with BAT0 (13.49Wh full) + BAT1 (23.72Wh full): before, showed 36% / 13Wh; after, correctly shows ~73% / 37Wh, matching `upower -i DisplayDevice` directly. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DXDQXGqQL9eNtwFwPBbQ5f
There was a problem hiding this comment.
Copilot wasn't able to review any files in this pull request.
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
Reviewed at 227fc45. The aggregation goal is right and the composite device is a reasonable way to get it, but as written this change has a regression that lands on every laptop, including the single-battery machines this PR is not trying to change. The composite device has no Measured against a realistic pair of The existing test fails at this head. Two smaller things. The description says the old code ignored the second battery's "percentage/capacity/cycles", but line 110 is unchanged and still does One claim I want to withdraw rather than leave standing: I initially suspected the composite percentage would differ from a single battery's own percentage on a one-battery machine. Checking UPower's aggregation, it passes a lone battery's percentage through rather than recomputing it, so that does not appear to be a real difference. Flagging it only so nobody inherits it as a finding. Nothing was pushed to your branch. The repair here is to keep the composite for the aggregate values and get the live rate by summing Reviewed by Claude Opus 5 in Claude Code and by Codex at xhigh reasoning. Codex agreed on the |
|
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. |
omarchy-battery-statuspicks the first battery device alphabetically (upower -e | grep BAT | head -n 1), which on dual-battery ThinkPads (e.g. T480 with an internal + hot-swap bay battery) only reports one battery's percentage/capacity/cycles while silently ignoring the other.This visibly disagrees with the power panel's progress bar and icon, which already correctly bind to UPower's composite
DisplayDevice(Quickshell.Services.UPower'sUPower.displayDevice) — so the panel shows a percentage number and a bar telling two different stories.This points the script at the same
DisplayDeviceobject the panel already uses, and checks itspresentstate (mirroring the QML'sisPresentcheck) instead of relying on the removed enumerate step to signal "no battery".Verified on a ThinkPad T480 with BAT0 (13.49Wh full) + BAT1 (23.72Wh full): before, showed
36% / 13Wh; after, correctly shows~73% / 37Wh, matchingupower -i DisplayDevicedirectly.