Repository navigation
Conversation
Critical battery notifications do not expire, so explicitly dismiss the warning when the battery recovers or stops discharging. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Reviewed and reproduced. The fix works for the case it describes, and it fixes #8813, which is now linked. Reproduction. I ran it on a worker built from the Omarchy ISO, with the real shell and notification service and a mock UPower on the system bus. In the mock, the battery dropped to 8% while discharging, and then either the charger was connected or the battery recovered to 100%.
Tests, on the worker. On the head, One gap, not caused by this change. If the shell restarts or the machine reboots while the warning is up, the critical toast is restored from Second opinion. It did not run. The reviewer's daily limit was used up, so this review is Claude Opus 5.5's alone. Related. Three other open pull requests also deal with this warning. #11959 dismisses it on a charger connect only, with no test. #12666 makes the warning normal urgency with a 12 second timeout, bundled with an unrelated toast-width change. #12115 includes a dismiss-and-retry version inside a large multi-area change. This one covers both a charger connect and a recovery, and it has a test. Which one lands is the maintainer's choice. Next. This waits on a second-opinion review and then on the maintainer. Nothing is needed from the author. |
|
Since the last review, The case this one misses. The low-battery warning is a critical toast, and the shell stores every toast on screen under Which one. The second opinion, Codex Medium, was given all seven open fixes (#11415, #11959, #12666, #13041, #14218, #14739 and #14825) without my conclusion. It independently found the same restart case, and it picked #13041 as the one to bring forward. I checked its reasoning against the source and it holds. However, #13041 is a change of policy, not just a fix: it makes any critical notification that asks for a timeout expire, so the battery warning would leave after 30 seconds even while the battery is still low. Whether that is acceptable is the maintainer's call. If it is not, #14739 and #14218 are the battery-side alternatives. Codex also pointed out their costs: #14739 starts a dismiss process every 30 seconds while the battery is healthy, and #14218 only looks for the restored toast during a fixed window of three checks. Not run. Because this pull request is not the one to bring forward, it was not run on a worker this time. It now conflicts with Next. This waits on the maintainer to choose among the open fixes. Nothing is needed from the author now. If this approach is chosen, it needs the restart case handled before it can be ready. |
|
Closing in favour of #16562, which fixes the low battery warning staying up on the new notification engine (#15932). Thank you for working on this. Your change pointed at the right moment to take the warning down, and #16562 credits it. #16562 matches the warning on its sender and icon rather than the English title, so it also works in other languages. It also covers the warning restored after a restart and one held behind an open notification deck. |
Summary
Root cause
Low-battery notifications use critical urgency, which intentionally gives them an infinite lifetime. The battery service reset its notification bookkeeping after recovery but never dismissed the visible critical toast.
Testing
bash ./test/shell.d/battery-test.shbash ./test/shell.d/notifications-test.shFixes #8813