Repository navigation
Warn about a low battery at 20% as well as 10% - #20264
Open
itxkarthik wants to merge 3 commits into
Open
itxkarthik wants to merge 3 commits into
itxkarthik wants to merge 3 commits into
Conversation
A pack whose gauge reads high, such as an uncalibrated replacement, can cut out above 10%, so the only warning never came. The shell now warns once at 20%, UPower's own PercentageLow, and once more at 10%. Each level is latched through AC flaps as before, and climbing back above one re-arms it. Fixes omacom#20084
Contributor
[Medium impact] The PR changes when battery warnings appear in the desktop shell. The earlier warning-queue issue still needs attention before merging. SummaryThe PR adds low-battery warnings at 20% and 10%.
Reviews (7) · Last reviewed commit: "Test that a low-battery warning due duri..." · Reviewed by Greptile |
A battery-low hook still running from the 20% warning made the 10% one return early, and its level was already latched, so it was lost for the rest of the discharge. Hold it and send it when the running warning exits.
Contributor
|
both of your commits are in #21013. the 20% and 10% thresholds stayed, and a warning that arrives while the previous hook is running is still queued. the dismiss path from #20286 uses that same latch instead of a second boolean. @dhh @omarchybot if 21013 lands, this can close as superseded. |
Contributor
|
Want your agent to iterate on Greptile's feedback? Try greploops. |
The 10% warning can come due while the 20% warning's omarchy-battery-low is still running. battery-test.sh now loads the battery service in a fixture, with a stub that records each level and keeps running briefly, and checks that 20 and then 10 are both sent. The fixture runs without a system bus, so the machine's own battery cannot add a warning. These checks come last because require_quickshell skips the rest of the file without a compositor.
itxkarthik
force-pushed
the
low-battery-warn-at-20
branch
from
December 1, 2026 05:56
5f1cc38 to
672d20a
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The only low-battery warning fires at 10% or below, once per discharge. A pack whose gauge reads high (an uncalibrated or aftermarket replacement, or voltage sag under load) can power off above that, so no warning is ever shown. In #20084 the pack cut out at a reported 12%.
The battery service now warns once at 20% and once more at 10%. 20% is UPower's own
PercentageLowdefault, so the shell's first warning lines up with where UPower already reports the battery as low.notifiedLowBatteryboolean becomeslowBatteryWarnedAt, the lowest threshold warned at this discharge.battery-lowhook still gets the percentage, now at each warning.Fixes #20084
Related: #17881 and #17387 also edit
shouldWarnLowBattery/ the battery service, so whichever lands second needs a small rebase.Test plan
bash test/shell.d/battery-test.shpasses; the updated cases fail onquattro.