Skip to content

Send the low battery warning as a normal toast that goes after 30 seconds - #16562

Merged
dhh merged 5 commits into
quattrofrom
low-battery-warning-dismiss
Oct 25, 2026
Merged

dhh merged 5 commits into
quattrofrom
low-battery-warning-dismiss

Conversation

@omarchybot

@omarchybot omarchybot commented Oct 25, 2026 •

Copy link
Copy Markdown
Collaborator

The low battery warning was sent as a critical toast, and on the new notification engine (#15932) critical toasts never expire and come back on every shell start. So once it was up it stayed: after plugging in, after the level recovered, and across restarts and reboots on AC.

It is now sent as a normal toast. omarchy-battery-low already asked for 30 seconds with -t 30000, and only critical urgency overrode that, so the warning now expires after 30 seconds on its own. One restored after a restart leaves after the engine's short restore grace. As an omarchy-action toast it still gets through Do Not Disturb, and the battery-low hook still runs.

The trade-off is deliberate: a warning sent while nobody is at the screen is gone after 30 seconds rather than waiting, and after plugging in it sits out the rest of its 30 seconds instead of going at once. The battery icon in the bar still shows the level. Like every non-critical card, its countdown pauses while the deck is open. A critical warning saved before this change is still critical, so it comes back once more after the update until it is dismissed.

This is the change #14639 by @elonmask proposed. It replaces the open attempts at the same bug, which dismissed the warning from the battery service and have been closed in favour of this: #15902 by @defer, #14218 by @emirbelkahia, #11415 by @gaburn, #11959 by @stappmus, #14825 by @kajhaccou and #15911 by @catlee.

Reviewed by Codex Medium and Muse Spark 1.3 High; neither found a defect.

Fixes #8813
Fixes #14639

Critical toasts never expire on the new notification engine and are restored on every shell start, so the warning stayed on screen after plugging in, after recovering, and across restarts. The battery service now closes it in process whenever a check finds the battery on AC or above the threshold, and again whenever a matching toast is shown while that holds: one restored at startup, released by a held deck, or delivered after the charger went in. It matches the sender and icon rather than the translated title, so it works in any language, and it spawns nothing. After a restart while still low, the restored warning gives way to the fresh one rather than stacking under it.

The notifications service gains the two pieces that needs: dismissWhere(app, appIcon), which reaches rows held behind an open deck or still waiting to be inserted as well as those on screen, and a shown signal for every row on its way to the screen, including a replacement folded into an insert still queued. dismissWhere drops a matching row's queued replacement, since one landing after the close would bring the card back. History asked for with showHistory is neither announced nor dismissed. A user's clone of the notifications plugin from before this change has neither piece, and the battery service carries on without them.

Fixes #8813
Fixes #14639

Co-Authored-By: Diogo Ferreira <diogo@underdev.org>
Co-Authored-By: Codex Medium <noreply@openai.com>
Co-Authored-By: Muse Spark 1.3 High <noreply@meta.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@omarchybot

Copy link
Copy Markdown
Collaborator Author

I ran this on a disposable Omarchy VM built from the ISO, with a mock UPower on the system bus, against quattro on the same machine:

Case quattro this branch
Warned at 8%, charger plugged in still up 20 s later gone in 0.5 s
Same, language set to German still up 20 s later gone in 0.5 s
Recovered to 100% while discharging still up 45 s later gone at the next 30 s check
Charger plugged in while the shell was down, shell started on AC still up 75 s later gone 1.6 s after the shell came back
Warning arrived while the deck was held open in keyboard mode, charger plugged back in still up 75 s later gone 15 s later, when the deck let go
Shell restarted while still low two warnings one
Config reloaded while still low – one, kept

./test/cli passes, and so do the battery, notifications and shell-idle-spawn tests. The full shell suite has three failures, and none come from this change: pkexec and the Apple first-run test fail on quattro on the same VM, and so does a lock screen timing budget in the same file as the lock timing check that failed here.

Codex Medium and Muse Spark 1.3 High reviewed it in four rounds, and neither had anything left to act on in the last one. The config-reload handling rests on their reading of the code rather than on the VM: the same scenario also kept the warning on the commit before that handling went in, so the VM didn't reproduce the case it guards. The tests cover the notifications service's side against the real functions. The battery service's wiring is covered only by the VM runs above.

Omarchy's AGENTS.md asks for full lines in docs/; the surrounding bullets predate that.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@greptile-apps

greptile-apps Bot commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge.

Summary

Low-battery warnings now use normal urgency so their existing 30-second timeout can take effect.

  • Low-battery warnings count down and disappear after 30 seconds.

No new actionable issues were found.

Reviews (2) · Last reviewed commit: "Send the low battery warning as a normal..." · Reviewed by Greptile

omarchybot and others added 3 commits October 25, 2026 06:22
…onds

As a critical toast it never expired on the new notification engine and came back on every shell start, so it stayed on screen after plugging in, after recovering, and across restarts on AC. It already asks for 30 seconds; only critical urgency overrode that. As an omarchy-action toast it still gets through Do Not Disturb.

Fixes #8813
Fixes #14639

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@omarchybot omarchybot changed the title Take the low battery warning down once the battery is no longer low Send the low battery warning as a normal toast that goes after 30 seconds Oct 25, 2026
@omarchybot

Copy link
Copy Markdown
Collaborator Author

This now takes the simpler route from #14639: the warning is a normal toast that expires, so the earlier comment about dismissing it from the battery service no longer applies.

Run on a disposable Omarchy VM built from the ISO, against quattro on the same machine, sending the warning the way the battery service does (omarchy-battery-low 8):

Case quattro this branch
Sent and left alone still up 30 s later gone after about 31 s
Sent with Do Not Disturb on shown, still up 40 s later shown, gone after 29 s
Shell restarted while it was up restored, still up 45 s later restored, gone 21 s later

./test/cli passes. Four tests fail in the shell suite: pkexec and the Apple first-run test also fail on quattro on the same VM, and the lock view timing budget and the i18n startup test passed or failed from one run to the next during this work. A change to this script and a docs line can't reach either.

Codex Medium and Muse Spark 1.3 High reviewed it and found no defect. Codex pointed out that the countdown pauses while the deck is open, as every non-critical card's does, and the docs say so.

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

Labels

bug Something isn't working

Projects

None yet

3 participants