Skip to content

Integrate power panel, charger, and battery state fixes - #21226

Closed
chessing234 wants to merge 14 commits into
omacom:quattrofrom
chessing234:integrate/power-battery
Closed

chessing234 wants to merge 14 commits into
omacom:quattrofrom
chessing234:integrate/power-battery

Conversation

@chessing234

Copy link
Copy Markdown
Contributor

Summary

These five open PRs all read the same battery. UPower.OnBattery stays false while a weak charger lets the battery drain, and it can stay stale after an unplug. Reviewing the charger panel and the profile autodetect separately is how those two readings drift apart.

The charger-announce helpers were merged next to the existing usage-history helpers in BatteryModel.js. Both stay exported.

Test plan

  • test/shell.d/battery-test.sh (the Quickshell charge-limit fixture skipped: no qs or dbus-run-session here)
  • test/shell.d/power-test.sh (charger split, weak-charger drain, and the stale-OnBattery profile cases)
  • test/shell.d/powerprofiles-set-test.sh and test/shell.d/battery-status-test.sh (both call scripts whose shebang is /bin/bash; this Mac's /bin/bash is 3.2 and has no mapfile)

Screenshots

No capture from this host. The charger section and the charger toast need a running Omarchy session.

Made with Cursor

emrgim and others added 11 commits December 2, 2026 07:30
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.
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.
A rejected hardware write leaves the one-time top-up marker in place.
Refresh the state when the process exits without rechecking the same
charge reading. A new battery event can still restore the limit.
Wait for Quickshell to handle the failed write before watching for a
retry, and wait for the successful write to clear the marker. Bound both
waits so slow startup or D-Bus calls do not fail a working implementation.
An unknown display state always picked AC, so a missed AC uevent could save
the battery preference under the AC key. Match the power panel's fallback and
cover both directions in the command test.
Keep immediate reads for panel opens, power source changes and
charge-limit updates. Poll the remaining battery telemetry every
30 seconds while the panel is open.
@chessing234

Copy link
Copy Markdown
Contributor Author

@omarchybot @dhh combined the overlapping power-panel and battery-state prs so the OnBattery reading only gets reviewed once.

@greptile-apps

greptile-apps Bot commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

Confidence Score: 5/5RetriggerView in Greptile

[Medium impact] The latest refresh fix appears safe to merge; the earlier visual-check request remains open.

Findings

  1. P2 Charger UI remains visually unchecked ▶

Summary

This PR brings charger notices, charger readings, battery-state profile choices, and charge-limit retry fixes together.

  • The power panel shows how a connected charger shares its power.
  • Power profiles follow the battery’s reported state.
  • The battery service confirms a charger connection before sending a toast.
  • Failed charge-limit writes wait for a new battery event before retrying.
  • Open power panels refresh battery readings every 30 seconds.

Reviews (4) · Last reviewed commit: "Refresh charger readings when external p..." · Reviewed by Greptile

Comment thread shell/plugins/panels/power/Panel.qml Resolved
Comment thread bin/omarchy-powerprofiles-set Resolved
Comment thread shell/plugins/panels/power/Model.js Resolved
@greptile-apps

This comment has been minimized.

The panel's state map left Unknown undefined, so a battery reporting state 0 never fell back to OnBattery and was read as on AC.
@chessing234

Copy link
Copy Markdown
Contributor Author

unknown battery state now falls back to onbattery. the panel state map includes upowerdevicestate.unknown, which was missing so state 0 was read as ac.

Comment thread shell/plugins/panels/power/Panel.qml Resolved
Comment on lines +728 to +732
Column {
id: chargerSection
readonly property var flow: root.chargerFlow
readonly property bool maxed: flow !== null && flow.maxed
visible: flow !== null

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Charger UI remains visually unchecked

The added charger section has not been checked in a running Omarchy session. The repository requires visual changes to be verified in the running UI, with screenshots and a recording when motion changes. The PR reports that no captures were made.

Check the charger section and toast in Omarchy, including the bar animations, and attach the required captures before merging.

File Used: AGENTS.md (source)

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

@chessing234

Copy link
Copy Markdown
Contributor Author

ready for a look @dhh @ryanrhughes

@emirb

emirb commented Dec 2, 2026

Copy link
Copy Markdown
Contributor

Thanks for the time you put into this. Some of the fixes you added on top catch real bugs in the original PRs. I'm closing it anyway, along with the other Integrate PRs.

Each bundle puts several people's work in one branch. We can't review it one change at a time or revert a single piece. Merging it would also leave every original PR open. That's why our PR template asks for one problem per PR.

None of the bundles ran on an Omarchy install either.

Please post each fix on the PR it belongs to, so its author can pick it up. If two PRs conflict, a comment on the later one helps us most. A small fix of your own, tested on a real install, is always welcome. Smaller and proven gets merged. Thanks!

@emirb emirb closed this Dec 2, 2026
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.

6 participants