Skip to content

Dismiss low battery warning when AC connects - #15911

Closed
catlee wants to merge 1 commit into
omacom:quattrofrom
catlee:fix/low-battery-notification-ac
Closed

catlee wants to merge 1 commit into
omacom:quattrofrom
catlee:fix/low-battery-notification-ac

Conversation

@catlee

@catlee catlee commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Connecting AC should dismiss the low-battery warning, even when a battery-low hook blocks after the notification has been sent. Give the warning a dedicated sender identity so dismissal works with translated titles and the critical alert still bypasses Do Not Disturb. The sender prints its notification ID after delivery; the battery service uses that completion event to queue dismissal behind popup insertion while hooks continue.

The tests run the real warning command with stubs, check the sender and urgency passed to the notification policy, preserve another sender with the same translated title, and cover send completion while a hook is blocked.

Tests: bash test/shell.d/notifications-test.sh, bash test/shell.d/battery-test.sh

@greptile-apps

greptile-apps Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no actionable issues were found.

Summary

Low-battery warnings now use a dedicated sender name and disappear when AC connects.

  • AC power dismisses the low-battery warning.
  • Critical battery alerts keep their Do Not Disturb treatment.

Diagram

sequenceDiagram
  participant Battery as Battery service
  participant Sender as Warning command
  participant Notifications as Notification service
  participant Hook as Battery hook
  Battery->>Sender: Send low-battery warning
  Sender->>Notifications: Deliver warning with dedicated sender
  Notifications->>Notifications: Queue popup insertion
  Notifications-->>Sender: Return notification ID
  Sender-->>Battery: Print notification ID
  Sender->>Hook: Run hook
  Battery->>Battery: Queue AC-state check
  Battery->>Notifications: Dismiss matching popups if AC is connected
Loading

Reviews (1) · Last reviewed commit: "Dismiss low battery warning after notifi..." · Reviewed by Greptile

@omarchybot

Copy link
Copy Markdown
Collaborator

Thanks for this. I read the diff at 4797f44 against quattro and the code it touches, but the classification is unsettled, so it has not been run on a worker or given a class label yet.

Two models classified it separately and disagreed. Claude Opus 5.5 called it a bug: on quattro, durationFor in shell/plugins/notifications/Service.qml returns 0 for critical urgency, so the low battery warning stays on screen after AC is connected until someone closes it by hand, and by then what it says is no longer true. Codex Medium called it an enhancement: nothing is malfunctioning, and dismissing on AC is new behaviour added to a warning that already works as designed.

Which reading applies decides how it is verified: a reproduction that fails on quattro for a bug, or exercising the new behaviour for a feature. That call is waiting on the maintainer, and nothing is needed from you in the meantime.

@omarchybot

Copy link
Copy Markdown
Collaborator

Closing in favour of #16562, which fixes the low battery warning staying up on the new notification engine (#15932). Thank you, Chris. Your change was written against the old engine's popupModel and dismissPopup(), which #15932 removed. #16562 takes the same in-process route through a small public dismissWhere(app, appIcon) on the new notifications service, matching on sender and icon, and credits your work.

@omarchybot omarchybot closed this Oct 25, 2026
@omarchybot

Copy link
Copy Markdown
Collaborator

A correction to the note above: #16562 has since taken the simpler route #14639 proposed. It sends the warning as a normal toast that expires after 30 seconds instead of dismissing it from the battery service. It still credits this pull request.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants