Skip to content

Add an Apple Silicon battery charge limit command - #497

Merged
scottjones merged 3 commits into
quattrofrom
feat/asahi-battery-charge-limit
Sep 23, 2026
Merged

scottjones merged 3 commits into
quattrofrom
feat/asahi-battery-charge-limit

Conversation

@malik-na

@malik-na malik-na commented Sep 22, 2026 •

Copy link
Copy Markdown
Member

Summary

  • Add omarchy battery charge limit to inspect and set SMC charge thresholds on supported Apple Silicon MacBooks.
  • Add an opt-in 80% cap with a 75% restart threshold, plus a 100% reset.
  • Keep full charging as the default and document the controls.
  • Write only the end threshold: the macsmc driver derives the start threshold from it and ignores writes to the start threshold.

Validation

  • test/shell.d/battery-charge-limit-test.sh
  • bash test/shell.d/battery-status-test.sh
  • test/shell.d/powerprofiles-set-test.sh
  • ./test/cli
  • Live on MacBookAir10,1 with Asahi kernel 7.1.13-3: read 100%/100%, set and read back 75%/80%, reset and verify 100%/100%.
  • PR CI syntax and test jobs passed on 1cae68d2.

The full local ./test/all suite ran 295 shell test files; 290 passed and five environment-dependent tests failed. Four require the separate omarchy-pkgs checkout. The graphical animation test passes when the inherited NO_COLOR=1 is unset.

@malik-na
malik-na requested a review from scottjones September 22, 2026 23:57

@scottjones scottjones left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Reviewed 1cae68d2124635972fb2bf546d712f4317ab9caf. No blocking findings.

The command matches the macsmc driver's threshold semantics, writes only the end threshold, and verifies both values afterward. Status stays unprivileged, and invalid arguments, failed writes, and unexpected readback are handled correctly.

Focused charge-limit, battery-status, and powerprofiles tests passed, as did command metadata and parser-aware syntax checks. The full local suite passed CLI and 294/295 shell test files; the sole failure was the previously confirmed low-disk condition in the unchanged update-lock test. Hosted CI is green, including ARM installation. Local battery tests used temporary fixtures; hardware validation is as reported in the PR.

Optional follow-up: use the shared shell test helper and cover unavailable threshold files and the root execution branch.

@scottjones
scottjones merged commit 00a2d31 into quattro Sep 23, 2026
7 checks passed
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