Repository navigation
Clear the low-battery toast when the charger is connected - #8895
chessing234 wants to merge 5 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
Dismisses persistent critical low-battery notifications when the system leaves the low-discharging state.
Changes:
- Tracks the prior low-battery notification state.
- Dismisses the warning through
omarchy-notification-dismiss. - Adds a shell regression test.
Tip
If you aren't ready for review, convert to a draft PR.
Click "Convert to draft" or run gh pr ready --undo.
Click "Ready for review" or run gh pr ready to reengage.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
shell/plugins/services/battery/Service.qml |
Dismisses the low-battery toast after leaving low-discharge state. |
test/shell.d/battery-clear-on-ac-test.sh |
Adds static regression checks. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| grep -q 'function clearLowBatteryWarning()' "$service_qml" || fail "battery service can dismiss the low-battery toast" | ||
| grep -q 'Time to recharge!' "$service_qml" || fail "battery service dismisses by the Time to recharge! summary" | ||
| grep -q 'omarchy-notification-dismiss' "$service_qml" || fail "battery service uses omarchy-notification-dismiss" | ||
| grep -q 'clearLowBatteryWarning()' "$service_qml" || fail "battery service calls clear when leaving low-discharging" |
| function clearLowBatteryWarning() { | ||
| if (clearWarningProcess.running) return |
|
Reviewed on a disposable Omarchy VM with the shell actually running from this branch ( Your read of the bug is right, and I proved the premise live rather than taking it from the issue: Two things worth fixing. The test passes on a tree where the fix is disabled. I deleted only grep -q 'else if (wasNotified && !state.notifiedLowBattery) clearLowBatteryWarning()' "$service_qml" || fail "battery service clears the toast when leaving the low-discharging state"The dismiss is one-shot, and it can be issued before the toast exists.
Both are narrow, but they land on the one path this change exists to fix. I have pushed nothing to your branch: how to close them is a design choice rather than a contained bug fix, so it belongs with the maintainer. Two things that are clean, and worth saying so plainly. On a battery-less machine — no One thing outside your diff that you should know about: #8838, #8458 and #7688 are all open and all fix #8813 as well. Which one lands is the maintainer's call, not mine — I have reviewed this one on its own merits and given them the comparison. |
|
@dhh @ryanrhughes ready for review |
Critical notifications ignore the send timeout, so "Time to recharge!" stayed up after UPower moved to AC. Dismiss it when we leave the low-discharging state.
ca78893 to
ca2105d
Compare
|
folding into #12115 with the other bar panel fixes |
Critical "Time to recharge!" notifications ignore the send timeout and can remain visible after AC is connected. Leaving the low-discharging state now dismisses that notification and retains dismissal intent across the existing 30-second battery polls. This retries when notification insertion follows the first dismissal, the dismissal process is busy, or the quiet CLI times out without acknowledgement. A new low-battery episode cancels the previous dismissal intent and waits for an in-flight dismissal process to finish before sending its warning.
Fixes #8813.
Validation:
bash test/shell.d/battery-clear-on-ac-test.shandbash test/shell.d/battery-test.shpass. The focused test executes the QML check and dismissal functions and covers the actual transition call, busy-process retry, and cancellation on a new low-battery episode.Live Quickshell verification remains pending: trigger the critical notification, connect AC during notification delivery, and confirm eventual dismissal. This requires an Omarchy desktop, unavailable in the current macOS environment.