Repository navigation
Conversation
The power panel's chargeThresholdActive() mirrors the three states omarchy-battery-status uses, but not its outer guard: the script only treats a charge as held when the battery actually reports a threshold, and omits the field entirely when no charge_control_* attribute exists. Without that guard, firmware that merely stops topping the pack up reads as a limit the machine has no way to set. Apple's SMC does exactly this, so a MacBookPro12,1 on AC at 94% showed "Charge limit -" / "Battery state Holding" and a "THRESHOLD" hero label, while the CLI correctly reported fully-charged. Thread the threshold through chargeThresholdActive(), batteryIcon() and modeLabel(), and drop the charge-limit row's now-unreachable "-" fallback. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BYs2Jy3APLhJpQxeC5qLrx
The bar icon now asks for the threshold too, but batteryInfo was only filled when the panel opened. Until then a machine that does hold at a limit read as having none, so a pack parked at 80% on pending-charge showed the charging icon in the bar. Load it when the bar comes up and when a battery appears, and retry every 30 seconds while closed until one lookup lands, since an empty answer is discarded and would otherwise wait for the panel to open. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Co-Authored-By: Codex Medium <noreply@openai.com>
The existing assertion only rejects one spelling of the old call, so dropping the argument with a space before the paren still passed. Check each of the three calls passes root.chargeThreshold. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Co-Authored-By: Codex Medium <noreply@openai.com>
|
Reviewed at f230612, run on a disposable Omarchy worker VM. Reviewed by Claude Opus 5.5 and, as a second opinion, Codex Medium over two rounds; the second round found nothing open. The reported bug is real and this fixes it. With the inputs from #10193 (on AC, One regression, fixed on your branch. The bar icon now takes the threshold too, but
Each new assertion was checked by breaking the code it covers and watching it fail. Tests. Related. #7915 also adds a fourth argument to Waiting on the maintainer. |
[Low impact] The changes affect battery status shown in the power panel and bar. The PR needs changes before merging: idle batteries still appear to be charging, and the retry must meet the shared-polling requirement. FindingsSummaryThe PR requires a reported charge threshold before showing a held charge.
Reviews (2) · Last reviewed commit: "Merge branch 'quattro' into power-panel-..." · Reviewed by Greptile |
| // firmware that merely stops topping the pack up: Apple's SMC parks at | ||
| // FullyCharged around 94% by design, and that read as a limit the machine | ||
| // has no way to set. | ||
| if (!threshold) return false |
There was a problem hiding this comment.
When a battery has no charge-control threshold, this guard correctly rules out a held charge, but the panel then treats AC-connected states below 100% as actively charging. A battery reported as FullyCharged at 94% gets a “Charging” stats row beneath a “Fully charged” heading. A PendingCharge battery gets charging phrases, a charging icon, and a pulsing bar even though it is not charging. These idle states need a display path distinct from threshold holding and active charging.
Knowledge Base Used: Hardware, devices, and power
|
|
||
| Timer { interval: 5000; running: root.opened; repeat: true; onTriggered: root.refresh() } | ||
| // A startup lookup that came back empty would leave the bar without the threshold until the panel opens. | ||
| Timer { interval: 30000; running: root.batteryPresent && !root.opened && root.batteryInfo.percentage === undefined; repeat: true; onTriggered: root.refreshBattery() } |
There was a problem hiding this comment.
Threshold display can stay stale
The new retry stops once battery status returns a percentage, even if that result omits the threshold. It also does not refresh after a charge limit changes while the panel stays closed. Because the bar icon now uses the cached threshold, it can keep showing the wrong charging or holding indication until the panel is opened. Refresh the threshold-dependent bar state independently of whether a percentage has arrived.
Knowledge Base Used: Shell UI and desktop interactions
quattro translated the power panel, giving modeLabel a fourth argument for the translator. The threshold goes before it, so modeLabel takes (device, onBattery, states, threshold, tr), and the charge-limit row shows the threshold through the panel's localized reading. The wiring assertion accepts the call with the translator after the threshold. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
This had stopped merging cleanly after Still fixes #10193 on current Tests. Greptile's two comments. Neither is a defect this change introduces.
Related. #7915 (for #7803) also threads limits through Waiting on the maintainer. |
|
Re-reviewed at 0ad3859, your merge of A competing fix. #9763 was opened two days before this one, and it fixes #10193's case the same way. Its Codex Medium and muse-wonder (pi, thinking high) each compared the three pull requests from their diffs, and both reached the same conclusion: #9763 fixes the bug, #10196 fixes it too, and #7915 does not. They had no concrete defect in #9763 that would let the newer fix take precedence. Both may have read this session's notes, so their agreement is not independent. The one point they added was the 100% end threshold handling above, which I then checked against #9763's diff. Choosing between #9763 and this pull request is the maintainer's call. Waiting on the maintainer. |
Fixes #10193.
The problem
Model.chargeThresholdActive()mirrors the three statesomarchy-battery-statususes to decide a charge is being held, but not its outer guard. The script requires a threshold to actually exist:and omits the
thresholdfield entirely when the battery exposes nocharge_control_*attribute.Model.jsonly checked that we are on AC, sostate === FullyCharged && fraction < 0.99was enough to claim a limit.Firmware that merely stops topping the pack up then reads as a charge limit the machine has no way to set. Apple's SMC does exactly this — it will not recharge until the pack falls to roughly 93–95%, the behaviour macOS surfaces as "Battery is charged". On a MacBookPro12,1 with no
charge_control_*sysfs at all, the panel claimed a limit while the CLI correctly reportedfully-charged.The change
Thread the threshold through
chargeThresholdActive(),batteryIcon()andmodeLabel(), and bail out when it is empty — the same condition the shell script already applies.Panel.qmlderives it frombatteryInfo.threshold, which is exactly the field the script omits when there is no threshold, so the two implementations now agree by construction.The charge-limit row's
|| "-"fallback goes away with it:chargeThresholdActivenow implies a non-empty threshold, so the row can no longer render a label with no value.Machines that genuinely have a threshold are unaffected — they report one, so the guard passes.
Verified
Automated:
test/shell.d/power-test.shextended with the no-charge-control case, its positive counterpart, andmodeLabelcoverage for both. Existing threshold assertions now pass a threshold, which is what the hardware they model would report.Panel.qmlsource pin the wiring: thechargeThresholdproperty must exist, and no threshold-awareModel.*call may end atupowerStates(). Both fail against the pre-fix file, so the guard cannot be silently orphaned again../test/all: the shell and CLI suites pass. Three files fail identically before and after this change on a clean checkout (config-test,snapper-test,unowned-system-paths-test) — all three need a siblingomarchy-pkgscheckout that isn't present here.qmllintonPanel.qml: no syntax errors, and no warnings beyond the import-resolution noise the unmodified file already produces.Visually, on the MacBookPro12,1 that reproduces this, with the patched files overlaid on the package install and the shell restarted:
THRESHOLDFULLY CHARGEDCharge limit/-Time to full/-Battery state/HoldingCharging/-Layout, spacing and the power-profile row are unchanged. A before/after capture is attached below.