Add graceful low-battery shutdown with a reserved charge display - #393
Open
malik-na wants to merge 2 commits into
Open
Add graceful low-battery shutdown with a reserved charge display#393malik-na wants to merge 2 commits into
malik-na wants to merge 2 commits into
Conversation
|
Verified on MacBookPro18,1 (M1 Pro, aarch64,
The multi-user |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a battery guard that starts a 60-second shutdown countdown at 5% hardware charge, or when estimated runtime is critically short. The desktop and battery-status command show a consistent usable-charge scale, with 5% hardware charge displayed as 1%.
The countdown updates one notification. During its final 15 seconds, the guard requests normal application window closes before standard systemd poweroff. Persistent deadlines and per-window attempts prevent restarts from extending the countdown or repeatedly dismissing save dialogs. Confirmed charging cancels the countdown. Includes package-backed setup and migrations for new and existing installs.
No session restore is attempted. Users must save their work; application close requests cannot guarantee unsaved-data preservation. The guard does not protect against battery drain while suspended.
Validation: focused battery, deployment, mapping, metadata, and syntax checks passed, along with independent review. A native disposable-window close test passed, and visual verification confirmed percentage alignment and one updating countdown notification. Full CLI suite passed; 258/259 shell test files exited successfully, with 17 coverage skips. The sole aggregate failure was unchanged network-QR behavior under sandbox netlink restrictions.
The earlier guard completed a real discharge shutdown. This revised 5% version is installed and running locally for the current boot; its next real discharge test remains pending.