Repository navigation
Conversation
The warning is sent as a critical toast, and critical toasts never expire and are restored from disk on every shell restart. A warning sent before shutdown therefore came back on the next boot with the laptop on the charger, and once shown it stayed on screen after plugging in until dismissed by hand. shouldWarnLowBattery now also reports when the battery is no longer low: present but not discharging at or below the threshold. On each battery check and power source change, the battery service then dismisses any toast titled with the low battery warning through the notifications service. It also watches the toast stack, so a stale warning brought back by the restore, which reads its files after the first battery check, is taken down as soon as it appears. The title is read once at startup with omarchy-i18n from the CLI catalog omarchy-battery-low sends it from, so the match holds in every language. The summary match the notifications IPC dismiss used moves into a dismissBySummary function on the service, which the IPC now calls, so other services can dismiss toasts in process without spawning omarchy-notification-dismiss. The battery model tests cover warning on battery, staying quiet and clearing a stale warning while charging, clearing on plugging in, and leaving notifications alone when there is no battery.
[Medium impact] The PR appears safe to merge; no new actionable issues were found. SummaryThe battery service now removes low-battery warnings after the battery recovers or starts charging.
Both earlier unnumbered findings are addressed: matching no longer depends on translated titles, and popup callbacks use the model’s dismissal decision. Reviews (3) · Last reviewed commit: "Do not notify if there is a notification..." · Reviewed by Greptile |
|
Reviewed at bb26e59 and run on a disposable Omarchy VM linked to this branch, with the kernel's What ran, on the base (60f5b49) and on this head:
Second opinion: Codex Medium reviewed it in two rounds. It raised one possible startup case: if UPower reported the battery present before its level and state, a check could read it as recovered and dismiss a warning that is still valid. That did not happen in the restart-while-low run above, and if it did, the same check clears the notified flag, so the warning is sent again on the next real reading. Codex withdrew it as a blocker, and its last round found nothing. It agreed with the rest of my reading, and its independence is not guaranteed. There are five other open pull requests for this bug: #11415, #11959, #14218, #14825 and #15911. This one handles cases the older ones miss. #11415, #11959 and #14825 match the English title "Time to recharge!", so on a translated desktop the warning never comes down, and none of the three clears a warning restored after a restart. #14218 clears restored warnings only during its first three checks, and it looks the title up in the current language, so a warning saved before a language change is never matched and keeps coming back. Matching on the sender and the This fixes #14639 and #8813, now linked. It is waiting on the maintainer. |
|
Reviewed again at c24ddfd, the commit that stops a second warning being sent while one is already up, and ran it on a disposable Omarchy VM linked to this branch with the kernel's The second warning after a restart that I noted last time is gone: restarting the shell while still at 8% now leaves exactly one warning on screen. The rest still holds against the base (60f5b49): plugged in at 8%, the warning stays on the base and comes down here; plugged in while the shell was down and restarted on AC, the base restores it and keeps it while this takes it straight down; recovered to 40% while still discharging, the base keeps it and this removes it.
Second opinion: Codex Medium reviewed the new commit in two rounds. In the first it pointed out that the new check looks for a warning in the toast stack rather than on screen, so after a restart while low, an old warning pushed below a tall stack of newer toasts would keep a fresh one from being sent. In the second it agreed this is no worse than the base, where a warning buried by later toasts in one session is never sent again until the battery recovers either, and that the check also keeps the The competing pull requests for this bug (#11415, #11959, #14218, #14825 and #15911) have not changed since they were compared, and the reasons this one covers more still stand. Which one lands is the maintainer's call, and this is waiting on them. |
|
Heads-up on the new notification engine (#15932, merged Oct 20, after this branch): the notification service no longer has |
|
Checked again against current
The design is still the best of the open fixes. Matching on app and icon works in any language, and reacting to the toast stack needs no spawned process. On Reviewed by reading the branch against |
|
Closing in favour of #16562, which ports this design to the new notification engine (#15932). Thank you, Diogo: matching the warning on its sender and icon, and reacting to the toast stack rather than the clock, is the approach #16562 takes, and you're credited as a co-author on its commit. This branch can't land as it is, because #15932 removed the |
The warning is sent as a critical toast, and critical toasts never expire and are restored
from disk on every shell restart. A warning sent before shutdown therefore came back on the
next boot with the laptop on the charger, and once shown it stayed on screen after plugging in
until dismissed by hand.
shouldWarnLowBattery now also reports when the battery is no longer low: present but not
discharging at or below the threshold. The battery service keeps that decision and, while it
holds, dismisses any toast from omarchy-action with the battery-caution icon
omarchy-battery-low sends. Matching on the app and icon rather than the title keeps it working
across a language change, and both are in the saved toast files, so warnings already on disk
match too. The service acts on every battery check, on power source and battery device
changes, and whenever the toast stack changes, so a stale warning brought back by the restore
is taken down as soon as UPower reports the battery, not on the next 30 second check. Without
a battery nothing is dismissed.
The summary match the notifications IPC dismiss used moves into a dismissWhere function on the
service, shared by dismissBySummary, which the IPC now calls, and a new dismissByAppIcon, so
other services can dismiss toasts in process without spawning omarchy-notification-dismiss.
The battery model tests cover warning on battery, staying quiet and clearing a stale warning
while charging, clearing on plugging in, and leaving notifications alone when there is no
battery.
Fixes #14639
Fixes #8813