Skip to content

feat(keepawake): stop Keep Awake from draining a low battery - #14

Merged
WolffTech merged 3 commits into
mainfrom
feat/keep-awake-low-battery
Oct 20, 2026
Merged

WolffTech merged 3 commits into
mainfrom
feat/keep-awake-low-battery

Conversation

@WolffTech

Copy link
Copy Markdown
Owner

Keep Awake kept a MacBook awake on battery power until it ran flat. It now turns itself off when the battery reaches 20% while unplugged, and you can change that percentage.

  • When it applies: only while running on battery. Charging, fully charged, or plugged in but not charging is ignored, and so is a Mac with no battery.
  • Staying off: at or below the cutoff, Keep Awake can't be turned back on until you plug in or the battery charges above it. The dashboard's cup is greyed out meanwhile, and its tooltip explains why.
  • Settings: Settings → Keep Awake has a new "Turn off on low battery" section. It has an on/off switch (on by default) and a stepper from 5% to 50% in 5% steps (20% by default). The section is hidden on Macs without a battery.
  • Matching the display: the charge is rounded to a whole percent before the comparison, so the cutoff fires at the same number the battery widget shows.

Testing

  • swift test in Packages/BarometryKit passes. New tests cover the cutoff turning Keep Awake off, blocking it from turning back on, being ignored while plugged in or without a battery, lifting when charging starts, and the new settings' defaults and persistence.
  • A Debug build of the app succeeds.

- Turn off Keep Awake at or below a cutoff while on battery
- Refuse to turn it back on until charging or above the cutoff
- Persist the cutoff, on by default at 20%, clamped to 5-50%
- Feed battery readings and the cutoff setting to Keep Awake
- Add cutoff toggle and 5% stepper to Keep Awake settings
- Disable the dashboard cup while the battery blocks it
- Document the cutoff in the README
@WolffTech
WolffTech merged commit febb0b0 into main Oct 20, 2026
2 checks passed
@WolffTech
WolffTech deleted the feat/keep-awake-low-battery branch November 10, 2026 20:23
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.

1 participant