mirror of
https://github.com/actuallymentor/battery.git
synced 2026-02-03 14:03:24 +00:00
dc775e7577e89c6e68fbd727381e5ea727505477
Battery charging manager
CLI for managing the battery charging status for M1 Macs. Can be used to enable/disable the Macbook from charging the battery when plugged into power.
The idea is to make it possible to keep a chronically plugged in Macbook at for example 80% battery, since that will prolong the longevity of the battery.
After running battery charging off you can verify the change visually by looking at the battery icon:
After running battery charging on you will see it change to this:
Installation
One-line installation:
curl https://raw.githubusercontent.com/actuallymentor/battery/main/setup.sh | bash
This will:
- Compile the
smctool from the hholtmann/smcFanControl repository - Install
smcto/usr/local/bin - Install
batteryto/usr/local/bin
Usage
For help, run battery without parameters:
Battery CLI utility v0.0.4.
Usage:
battery status
output battery SMC status, % and time remaining
battery charging SETTING
on: sets CH0B to 00 (allow charging)
off: sets CH0B to 02 (disallow charging)
battery charge LEVEL
LEVEL: percentage to charge to, charging is disabled when percentage is reached.
battery maintain LEVEL
LEVEL: percentage under which to charge, and above which to disable charging.
battery visudo
instructions on how to make which utility exempt from sudo
battery update
run the installation command again to pull latest version
battery uninstall
enable charging and remove the `smc` tool and the `battery` script
Languages
Shell
53.5%
JavaScript
46.5%

