# actuallymentor/battery

**Attribution required: if you use, quote, or summarise this content, you must credit and link back to [awesome-repositories.com](https://awesome-repositories.com/repository/actuallymentor-battery).**

6,676 stars · 265 forks · Shell · mit

## Links

- GitHub: https://github.com/actuallymentor/battery
- awesome-repositories: https://awesome-repositories.com/repository/actuallymentor-battery.md

## Description

Battery is a command-line and graphical utility for macOS that manages battery charging behavior to prolong battery lifespan. It functions as a charge limiter, allowing users to set a maximum charge threshold—typically 80%—and maintain that limit across reboots and even when the application is closed. The tool also includes a battery sensor calibration feature that discharges the battery to a low level and then fully recharges it to restore accurate capacity reporting.

The project distinguishes itself by offering both a CLI and a GUI for controlling charging behavior, supporting custom percentage targets and manual toggling of the charging circuit regardless of whether the power adapter is connected. It can maintain battery charge within a user-specified percentage range by automatically stopping and resuming charging, and it can drain the battery to a target level by blocking power input from the adapter. Settings persist across system restarts through a state file, ensuring consistent battery protection policies.

Battery provides real-time monitoring of power adapter events through ACPI netlink hooks, adjusting charging behavior in response to plug/unplug events. It runs as a background service managed by systemd, with command-line tools communicating with the daemon via Unix domain sockets or D-Bus. The tool also displays current SMC status, charge percentage, and estimated time remaining.

## Tags

### System Administration & Monitoring

- [Charge Limiters](https://awesome-repositories.com/f/system-administration-monitoring/energy-management/home-battery-integrations/charge-limiters.md) — Limits battery charging to 80% when plugged in to prolong battery lifespan, even after rebooting. ([source](https://github.com/actuallymentor/battery#readme))
- [CLI and GUI Battery Managers](https://awesome-repositories.com/f/system-administration-monitoring/energy-management/home-battery-integrations/laptop-battery-managers/cli-and-gui-battery-managers.md) — Provides both a command-line and graphical interface for controlling battery charging limits and behavior.
- [Embedded Controller Charge Controls](https://awesome-repositories.com/f/system-administration-monitoring/energy-management/home-battery-integrations/charge-limiters/ev-charging-control/embedded-controller-charge-controls.md) — Interacts with the embedded controller to manage battery charging hardware at the kernel level.
- [Range-Based Charge Maintainers](https://awesome-repositories.com/f/system-administration-monitoring/energy-management/home-battery-integrations/charge-limiters/range-based-charge-maintainers.md) — Keeps the battery charge within a user-specified percentage range by automatically stopping and resuming charging. ([source](https://github.com/actuallymentor/battery#readme))
- [Laptop Battery Managers](https://awesome-repositories.com/f/system-administration-monitoring/energy-management/home-battery-integrations/laptop-battery-managers.md) — Keeps the battery charge within a user-specified percentage range to prolong its lifespan. ([source](https://github.com/actuallymentor/battery#readme))
- [macOS Battery Managers](https://awesome-repositories.com/f/system-administration-monitoring/energy-management/home-battery-integrations/laptop-battery-managers/macos-battery-managers.md) — Manages battery charge thresholds and charging behavior specifically on Apple Silicon and Intel Macs.
- [Graphical Charge Managers](https://awesome-repositories.com/f/system-administration-monitoring/energy-management/home-battery-integrations/charge-limiters/graphical-charge-managers.md) — Ships a graphical interface to adjust battery charging limits without requiring command-line usage. ([source](https://github.com/actuallymentor/battery#readme))
- [Manual Charge Overrides](https://awesome-repositories.com/f/system-administration-monitoring/energy-management/home-battery-integrations/charge-limiters/manual-charge-overrides.md) — Ships a manual override to immediately enable or disable charging regardless of the automatic schedule. ([source](https://github.com/actuallymentor/battery#readme))
- [Persistent](https://awesome-repositories.com/f/system-administration-monitoring/energy-management/home-battery-integrations/charge-limiters/persistent.md) — Keeps the 80% charge limit active after system restarts and even when the tray app is closed. ([source](https://github.com/actuallymentor/battery#readme))
- [Persistent Charge Configurations](https://awesome-repositories.com/f/system-administration-monitoring/energy-management/home-battery-integrations/charge-limiters/persistent-charge-configurations.md) — Preserves configured charge limits across system restarts and even when the tray application is closed. ([source](https://github.com/actuallymentor/battery#readme))
- [Target Charge Level Chargers](https://awesome-repositories.com/f/system-administration-monitoring/energy-management/home-battery-integrations/charge-limiters/target-charge-level-chargers.md) — Charges the battery to a target percentage and then stops charging automatically. ([source](https://github.com/actuallymentor/battery#readme))
- [Battery Calibrators](https://awesome-repositories.com/f/system-administration-monitoring/energy-management/home-battery-integrations/laptop-battery-managers/battery-calibrators.md) — Discharges and recharges the battery to restore accurate capacity reporting. ([source](https://github.com/actuallymentor/battery#readme))
- [Battery Dischargers](https://awesome-repositories.com/f/system-administration-monitoring/energy-management/home-battery-integrations/laptop-battery-managers/battery-dischargers.md) — Blocks power input from the adapter until the battery drains to a user-defined percentage. ([source](https://github.com/actuallymentor/battery#readme))
- [Sysfs Polling Monitors](https://awesome-repositories.com/f/system-administration-monitoring/polling-based-health-monitors/sysfs-polling-monitors.md) — Periodically reads battery percentage from sysfs to detect charge level changes and trigger actions.

### Development Tools & Productivity

- [ACPI Parsers](https://awesome-repositories.com/f/development-tools-productivity/command-line-parsers/acpi-parsers.md) — Monitors power adapter plug/unplug events via ACPI netlink to adjust charging behavior in real time.
- [ACPI Netlink Event Hooks](https://awesome-repositories.com/f/development-tools-productivity/command-line-parsers/acpi-parsers/acpi-netlink-event-hooks.md) — Monitors power adapter plug/unplug events via ACPI netlink to adjust charging behavior in real time.

### Part of an Awesome List

- [Battery Sensor Calibrators](https://awesome-repositories.com/f/awesome-lists/devtools/sensor-calibration/battery-sensor-calibrators.md) — Recalibrates the battery sensor by fully discharging and recharging to restore accurate capacity reporting.

### DevOps & Infrastructure

- [Systemd Services](https://awesome-repositories.com/f/devops-infrastructure/systemd-services.md) — Runs as a background service managed by systemd to enforce charge policies across reboots.

### Operating Systems & Systems Programming

- [Battery Power Optimization](https://awesome-repositories.com/f/operating-systems-systems-programming/power-management/battery-power-optimization.md) — Blocks power input from the adapter until the battery drains to a user-specified percentage. ([source](https://github.com/actuallymentor/battery#readme))

### Software Engineering & Architecture

- [Filesystem Polling](https://awesome-repositories.com/f/software-engineering-architecture/polling-based-input-models/filesystem-polling.md) — Periodically reads battery percentage from the sysfs filesystem to detect charge level changes.
- [Boot-Persistent State Persisters](https://awesome-repositories.com/f/software-engineering-architecture/workflow-persistence/state-persistence/boot-persistent-state-persisters.md) — Stores charge limit and mode settings in a file that survives reboots and application restarts.
