Skip to content

Keep low-battery warnings visible and audible - #20286

Open
kairosci wants to merge 5 commits into
omacom:quattrofrom
kairosci:fix/sticky-audible-low-battery
Open

kairosci wants to merge 5 commits into
omacom:quattrofrom
kairosci:fix/sticky-audible-low-battery

Conversation

@kairosci

@kairosci kairosci commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #20085. Low-battery alerts now use critical urgency and stay visible until dismissed or the battery starts charging or recovers above 20%. If charging stops briefly before recovery, the warning is re-armed and appears again while the battery is still low and discharging.

The shipped warning-sound hook is active by default. Migration 1795704847 installs it for existing users when missing, preserves customized hooks, and waits for the settings package if its default hook has not arrived yet. This complements #20264, which adds 20% and 10% warning thresholds.
bash test/shell.d/battery-test.sh passes, covering warning decisions, dismissal/re-arm behavior, urgency, and the localized dismissal command.
Ran migration 1795704847 against temporary homes: it exits 75 when the settings package is absent, installs the default hook once available, and preserves an existing custom hook.
I did not play the sound on the active desktop; audio output and sound-theme availability are machine-specific.

No layout or styling change: the notification card keeps its existing appearance; this changes its lifetime, recovery behavior, and default warning sound.

@greptile-apps

greptile-apps Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Confidence Score: 5/5 · The PR appears safe to merge; the previously reported lost warning is fixed.RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; the previously reported lost warning is fixed.

Summary

Keeps low-battery warnings visible until dismissed, charging starts, or the battery recovers above 20%.

  • Low-battery warnings stay visible until charging or recovery.
  • Low-battery warnings play the default sound for existing users.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Battery is low and draining] --> B{Warning command busy?}
  B -->|Yes| C[Leave warning eligible for retry]
  C --> D[Next battery check]
  D --> A
  B -->|No| E[Start warning and mark notified]
  E --> F[Charging starts or battery recovers]
  F --> G[Dismiss warning]
Loading

Reviews (6) · Last reviewed commit: "Retry battery warning after an active se..." · Reviewed by Greptile

Comment thread bin/omarchy-battery-low Resolved
@greptile-apps

This comment has been minimized.

Comment thread migrations/1795704847.sh Resolved
@omarchybot omarchybot added the enhancement New feature or request label Nov 26, 2026
@itxkarthik

Copy link
Copy Markdown

Thanks @kairosci, agreed these fit together: #20264 changes when the warning fires, this one changes how it's shown. They edit the same lines in Service.qml and BatteryModel.js, though, so whichever lands second needs a small rebase.

One difference to settle before then is re-arming on charge. #20264 deliberately doesn't re-arm when charging starts: a loose cable or AC flap right at a threshold would otherwise warn again on every reconnect. It re-arms only when the level climbs back above a threshold. This PR re-arms after charging stops below 20%. With critical, sticky notifications and a sound, a flickering charger would repeat that alert, so I'd keep re-arming tied to the level recovering. Happy to adapt either PR to whatever the maintainers prefer.

@IvanJS17, on your measurements in #20084: the thresholds in #20264 are a list (batteryThresholds: [20, 10]), so adding 25%, 15% or 7% is a one-line change if maintainers want earlier or more frequent warnings. I kept it to UPower's PercentageLow default to start.

@kairosci
kairosci force-pushed the fix/sticky-audible-low-battery branch from b2eb81e to d017e81 Compare November 30, 2026 18:18
@kairosci
kairosci force-pushed the fix/sticky-audible-low-battery branch from d017e81 to b8c4c38 Compare November 30, 2026 18:20
@chessing234

Copy link
Copy Markdown
Contributor

your five commits are in #21013. dismiss on charge or after recovery is still there, and the latch is the 20/10 warnedAt value rather than notifiedLowBattery. it is not persisted, so a restart while the pack is still low warns again. @dhh @omarchybot if 21013 lands, this can close as superseded.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

4 participants