Skip to content

Announce when the charger is connected - #20780

Open
emrgim wants to merge 2 commits into
omacom:quattrofrom
emrgim:feat/charger-connected-notification
Open

emrgim wants to merge 2 commits into
omacom:quattrofrom
emrgim:feat/charger-connected-notification

Conversation

@emrgim

@emrgim emrgim commented Nov 29, 2026 •

Copy link
Copy Markdown

What changes

Plugging in the charger does not announce itself. The shell already watches the UPower power-source change — it switches the power profile and re-arms a one-time charge limit — but nothing says the charger is in.

This sends a normal, transient toast when line power arrives after the machine has been on battery. The title is "Charger connected"; the body is the usual battery status line. A flip shorter than two seconds is ignored, so a USB-C renegotiation, or a UPower reading that settles at startup, does not announce a charger that was not just plugged in. A machine with no battery is unchanged.

Verification

  • bash test/shell.d/battery-test.sh passes, including the new cases. Forcing the announce predicate to return false fails battery announces a charger connected after time on battery; restoring it, the file passes.
  • I18N_STRUCTURAL=1 bash test/shell.d/i18n-test.sh passes, including no embedded English literals.
  • bash -n bin/omarchy-battery-plugged passes.
  • Did not run ./test/all. It needs a full Omarchy session. Did not plug a cable into the machine: the screenshot is the toast the new command sends, not a live plug event. The transition itself is covered by the model test.

Screenshots

The toast the new command sends: title "Charger connected", battery status as the body.

Charger connected

Opened by grok-4.7 via Hermes Agent.

Send a transient toast when line power arrives after the machine has been on battery. A flip shorter than two seconds is ignored, so a USB-C renegotiation or a UPower reading that settles at startup does not announce a charger that was not just plugged in.
@greptile-apps

greptile-apps Bot commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

Confidence Score: 5/5 · The PR appears safe to merge; the previous missed-toast issue is addressed.RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; the previous missed-toast issue is addressed.

Summary

Adds a normal, transient charger-connected toast with translated text and the current battery status.

  • The battery service announces a charger after a sustained switch to line power.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[AC arrives after at least two seconds on battery] --> B[Keep announcement pending]
  B --> C[Wait 500 ms]
  C --> D{Power stays connected?}
  D -->|Yes| E[Send charger toast]
  D -->|Brief drop| F[Keep pending]
  F -->|AC returns| C
  F -->|Two seconds on battery| G[Clear pending]
Loading

Reviews (2) · Last reviewed commit: "Keep the charger toast across a short re..." · Reviewed by Greptile

A USB-C blip during the confirm wait was clearing the on-battery clock, so plugging back in within two seconds never qualified. A confirmation already earned stays pending across that blip and is dropped only if the machine stays on battery through the window.
@chessing234

Copy link
Copy Markdown
Contributor

both of your commits are in #21013. the charger announcement sits next to the low-battery warnings in BatteryModel.js. joining it had dropped the usage-history function into the same brace. that is split back apart, and a short reconnect still keeps the toast. @dhh @omarchybot if 21013 lands, this can close as superseded.

@chessing234

Copy link
Copy Markdown
Contributor

thanks. plugging in still announces after time on battery, and a short reconnect keeps that confirmation, in #21226. Please close this PR as superseded by #21226.

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

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants