Repository navigation
Warn about a low battery whenever it is discharging, plugged in or not - #15009
omarchybot wants to merge 1 commit into
Conversation
The guard also required UPower.onBattery, which is false whenever any line-power supply is online. A dock or charger that supplies less than the machine draws keeps it false while the battery drains to the critical action, so the warning never fired in the case the user is least likely to be watching. The battery's own state already answers whether it is draining; the 3.x battery monitor checked only that. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
|
Overlap: #11161 ("Warn on low battery even when line power is online") makes the same change, dropping the |
|
#11161 is an older, open fix for #10939, also against Beyond #11161, this pull request removes the now-unused Compared by reading both diffs against #14825 and #14218 dismiss the warning whenever line power is present, which would clear it at once in the docked case #10939 is about. Choosing between that and warning while docked is the maintainer's decision. Waiting on the maintainer. |
isDischarging no longer reads onBattery, so taking it only suggests the warning still depends on it. Both callers are in Service.qml. The tests now also cover a missing battery and a charging battery staying silent, folded in from omacom#15009. Co-Authored-By: Omarchybot <317366263+omarchybot@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Warn on low battery even when line power is online When a machine is connected to a dock or power supply that delivers less power than the system draws, UPower.onBattery is false because a line-power source is online, but device.state is Discharging. Previously, isDischarging required onBattery to be true. As a result, shouldWarnLowBattery returned false throughout the discharge and suppressed the low-battery warning until the system was force-suspended at critical charge. Rely directly on device.state === dischargingState in isDischarging while preserving the onBattery argument for API compatibility. Fixes #10939 * Drop the unused onBattery parameter from the low-battery model isDischarging no longer reads onBattery, so taking it only suggests the warning still depends on it. Both callers are in Service.qml. The tests now also cover a missing battery and a charging battery staying silent, folded in from #15009. Co-Authored-By: Omarchybot <317366263+omarchybot@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Omarchybot <317366263+omarchybot@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
|
Closing as obsolete: #11161 merged into Checked by Claude Opus 5.5 comparing the two diffs, with Claude Opus 5.5 at high effort as the second opinion, which independently found nothing here that #11161 lacks. |
The low-battery warning only fired when UPower's
OnBatterywas true as well as the battery reportingDischarging.OnBatteryis false whenever any line-power supply is online, so a dock or charger that supplies less than the machine draws keeps it false while the battery drains all the way to UPower's critical action. The warning stayed silent in the one case where the user has the least reason to watch the battery, because they believe they are plugged in.This drops the
onBatteryterm fromisDischargingandshouldWarnLowBatteryinBatteryModel.js, so the warning reads the battery's own state, as the 3.xomarchy-battery-monitordid before the warning moved into the shell. A battery held at a charge limit reportsPendingCharge, notDischarging, so it still does not warn.UPower.onBatterystays where it means where the power comes from: choosing the power profile andpowerSaverOnBattery.Run on a worker with the shell loaded from this branch: a battery reporting
Dischargingat 8% with line power online warns here and stays silent onquattro.battery-test.shcovers the model without the parameter, including that a charging battery does not warn. Codex Medium reviewed it and found nothing to change.#14825 dismisses the warning whenever
omarchy-power-presentreports line power, which would clear it straight away in the docked case this fixes.Fixes #10939