Skip to content

Automatic Low Power Mode Manager for macOS - Menu bar app that enables Low Power Mode at customizable battery threshold

License

Unknown, Unknown licenses found

Licenses found

Unknown
LICENSE
Unknown
LICENSE.md
Notifications You must be signed in to change notification settings

danielalanbates/lowpowerautomator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

8 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Battery Saver for macOS

Automatic Low Power Mode Manager - A lightweight macOS menu bar application that automatically enables Low Power Mode when your battery reaches a customizable threshold.

macOS Python License

โœจ Features

  • ๐Ÿ”‹ Dual Operating Modes:
    • Automatic Mode - Automatically enables Low Power Mode at your threshold (requires one-time setup)
    • Prompt Mode - Asks you to enable Low Power Mode manually (works immediately, Mac App Store compatible)
  • ๐ŸŽš๏ธ Threshold Slider - Easily adjust activation threshold from 5% to 95% via dropdown menu
  • ๐Ÿ’ค Visual Indicators - Clear menu bar icons show battery and Low Power Mode status
  • โšก Manual Controls - Enable or disable Low Power Mode with one click
  • ๐Ÿ”” Smart Notifications - Get notified when Low Power Mode is activated
  • ๐Ÿ’พ Persistent Settings - Your preferences are saved and restored automatically
  • ๐Ÿš€ Auto-Launch - Optional automatic startup on login via LaunchAgent
  • ๐Ÿ”“ Passwordless Operation - Optional setup for password-free Low Power Mode switching

๐Ÿ“ธ Screenshots

Menu Bar Interface:

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ Threshold: 20%               โ–ถ   โ”‚ โ† Slider submenu (5-95%)
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ โœ“ Enabled                        โ”‚ โ† Enable Low Power Mode
โ”‚   Disabled                       โ”‚ โ† Disable Low Power Mode
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ Mode: Automatic                  โ”‚ โ† Toggle between Auto/Prompt
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ Current Battery                  โ”‚
โ”‚ Current Power Mode               โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ About                            โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ Quit                             โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Menu Bar Icons:

  • ๐Ÿ’ค Low Power Mode is ON
  • ๐Ÿ”Œ Charging (AC Power)
  • ๐Ÿ”‹ On Battery (normal)
  • ๐Ÿชซ Low Battery (โ‰ค 20%)
  • โšก At Threshold

๐Ÿš€ Quick Start

Installation

  1. Clone the repository:

    git clone https://github.com/daniel/battery-saver.git
    cd battery-saver
  2. Install dependencies:

    pip3 install -r requirements.txt
  3. Run the app:

    ./start_battery_saver.sh

The app will appear in your menu bar!

Auto-Launch on Login (Optional)

./install_launch_agent.sh

Battery Saver will now start automatically every time you log in.

Operating Modes

Battery Saver has two modes:

1. Prompt Mode (Default)

  • Works immediately, no setup required
  • Opens System Settings when battery hits threshold
  • You manually enable Low Power Mode
  • Mac App Store compatible

2. Automatic Mode (Recommended)

  • Enables Low Power Mode automatically
  • Requires one-time passwordless setup:
    ./setup_passwordless_pmset.sh
  • Creates a secure sudoers rule for pmset lowpowermode only

Switch modes: Click "Mode: ..." in the menu to toggle between Auto and Prompt modes.

๐Ÿ“‹ Requirements

  • macOS 10.14 (Mojave) or later
  • Python 3.7 or later
  • rumps library (installed via requirements.txt)

๐ŸŽฎ Usage

Setting Your Threshold

  1. Click the Battery Saver icon in your menu bar
  2. Hover over "Threshold: XX%"
  3. Select your desired percentage (5-95%)
  4. Done! Low Power Mode will now activate at that battery level

Manual Control

  • Click "Enabled" to immediately enable Low Power Mode
  • Click "Disabled" to immediately disable Low Power Mode
  • Checkmark shows which mode is currently active

Checking Status

  • Current Battery - View battery level and power source
  • Current Power Mode - Check if Low Power Mode is active

๐Ÿ”ง Advanced Features

Background Daemon Mode

Run Battery Saver completely invisibly with no menu bar icon:

./install_daemon.sh

Control via command line:

python3 battery_control.py status
python3 battery_control.py threshold 25
python3 battery_control.py enable
python3 battery_control.py disable

See BACKGROUND_MODE.md for full documentation.

Minimal Version

For a version designed to sit next to the system battery icon:

python3 battery_saver_minimal.py

See ICON_STYLES.md for details on different icon styles.

๐Ÿ“š Documentation

๐Ÿ”’ Security & Privacy

Battery Saver:

  • โœ… Stores settings locally in ~/.battery_saver_config.json
  • โœ… Does not collect or transmit any data
  • โœ… Does not access the internet
  • โœ… Is fully open source
  • โœ… Passwordless setup only affects pmset lowpowermode command

๐Ÿ› ๏ธ How It Works

  1. Monitors your battery level every 30 seconds
  2. Detects when you're on battery power (not plugged in)
  3. Activates Low Power Mode when battery โ‰ค your threshold
  4. Uses macOS pmset command to control Low Power Mode
  5. Logs everything for troubleshooting

๐Ÿ—‚๏ธ Project Structure

Battery_saver/
โ”œโ”€โ”€ battery_saver.py              # Main menu bar application
โ”œโ”€โ”€ battery_saver_daemon.py       # Background daemon (no UI)
โ”œโ”€โ”€ battery_saver_minimal.py      # Minimal version
โ”œโ”€โ”€ battery_control.py            # CLI control tool
โ”œโ”€โ”€ start_battery_saver.sh        # Quick launch script
โ”œโ”€โ”€ install_launch_agent.sh       # Auto-start installer
โ”œโ”€โ”€ install_daemon.sh             # Background daemon installer
โ”œโ”€โ”€ setup_passwordless_pmset.sh   # Passwordless setup
โ”œโ”€โ”€ requirements.txt              # Python dependencies
โ”œโ”€โ”€ README.md                     # This file
โ””โ”€โ”€ LICENSE                       # MIT License

๐Ÿงช Testing

Run the test suite:

python3 test_battery_functions.py

Expected output:

โœ… Battery level detection working
โœ… Power mode detection working
โœ… Config file exists

๐Ÿค Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

๐Ÿ“ License

This project is licensed under the MIT License - see the LICENSE file for details.

MIT License

Copyright (c) 2025 Daniel

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

๐Ÿ™ Acknowledgments

  • Built with rumps - Ridiculously Uncomplicated macOS Python Statusbar apps
  • Uses macOS pmset for power management

๐Ÿ’ฌ Support

๐Ÿ”„ Changelog

[1.1.0] - 2025-10-24

Added:

  • Dual mode support: Automatic Mode and Prompt Mode
  • Automatic mode detection (checks if passwordless sudo is configured)
  • User-switchable modes via menu
  • Prompt Mode opens System Settings with helpful notifications
  • Updated About dialog with mode information
  • Mac App Store compatibility via Prompt Mode

Changed:

  • Default mode is now Prompt Mode (no setup required)
  • Enhanced user experience with mode indicators
  • Version bumped to 1.1.0

[1.0.0] - 2025-10-18

Added:

  • Initial release
  • Automatic Low Power Mode activation at customizable battery threshold
  • Menu bar application with visual battery indicator
  • Threshold slider submenu (5-95%)
  • Manual Low Power Mode enable/disable controls
  • Smart notifications
  • Persistent configuration
  • LaunchAgent support for auto-launch
  • Background daemon mode (no UI)
  • CLI control tool
  • Passwordless sudo setup
  • Comprehensive documentation

๐Ÿšฆ Status

Version: 1.1.0 Status: Stable Last Updated: October 24, 2025 Compatibility: macOS 10.14+ (Mojave and later)


Made with โค๏ธ for macOS users who want smarter battery management


License

Copyright (c) 2025 Daniel Bates / BatesAI

This project is licensed under the MIT License - see the LICENSE file for details.

Copyright Notice

While this code is open source under the MIT License, the BatesAI brand name and associated trademarks are proprietary. Please do not use the BatesAI name or logo without permission.

For commercial support or custom development, contact: daniel@batesai.org

License & Commercial Use

  • Personal tinkering: Free to download, study, and modify for your own hobby, learning, or research projects as long as you keep the required credit.
  • Attribution: Always display โ€œBuilt with BatesAI software by Daniel Bates (https://batesai.org)โ€ anywhere the app, docs, marketing pages, or listings mention the product.
  • Organizations & monetization: Any company, client, employer, school, nonprofit, or government team must either obtain a BatesAI commercial license (daniel@batesai.org) or remit a 10% share of gross receiptsโ€”including one-time purchases, subscriptions (monthly, annual, seat-based, usage-based), service retainers, and bundled salesโ€”that rely on this software.
  • Reporting: Revenue-share users must send monthly revenue summaries plus payment within 15 days of month-end or the license automatically pauses.

Read the full โ€œBatesAI Personal & Revenue Share License v1.1โ€ in LICENSE for legal terms, including no sublicensing and California governing law.

About

Automatic Low Power Mode Manager for macOS - Menu bar app that enables Low Power Mode at customizable battery threshold

Topics

Resources

License

Unknown, Unknown licenses found

Licenses found

Unknown
LICENSE
Unknown
LICENSE.md

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •