Skip to content

philling-dev/battery-charge-limiter

Repository files navigation

🔋 Battery Charge Limiter for Linux

License: MIT Platform

A modern and user-friendly utility to limit battery charging on your Linux laptop, helping to extend battery lifespan and health.

✨ Features

  • 🖥️ Graphical Interface: Easy-to-use GUI for non-technical users with system tray support
  • ⌨️ Command Line Interface: Powerful CLI for advanced users and automation
  • 🔋 Extends Battery Lifespan: Prevents constant 100% charging that degrades battery over time
  • ⚡ Real-time Control: Instantly apply charge limits without rebooting
  • 🎯 Smart Presets: Quick preset options (60%, 80%, 90%) for different usage patterns
  • 📊 Battery Information: Display detailed battery model, manufacturer, and status
  • 🔄 Persistent Settings: Charge limits persist across reboots via systemd service
  • 🛠️ Broad Compatibility: Works with most ASUS, Lenovo, Dell, and other laptops supporting sysfs

🚀 Installation

Quick Install

  1. Clone the repository:

    git clone https://github.com/philling-dev/battery-charge-limiter.git
    cd battery-charge-limiter
  2. Run the installation script:

    bash install.sh

The installer will:

  • Install system dependencies (Python, PyQt6)
  • Check battery charge limiting compatibility
  • Install the application with both GUI and CLI interfaces
  • Create desktop menu entry for easy access
  • Set up optional systemd service for automatic application

What Gets Installed

  • GUI Application: battery-limiter-gui - Graphical interface accessible from applications menu
  • CLI Tool: battery-limiter - Command-line interface for scripts and advanced users
  • Desktop Entry: "Battery Charge Limiter" appears in Settings/System categories
  • System Tray: Convenient access and quick controls

📖 Usage

🖥️ Graphical Interface (Recommended for most users)

Launch from Applications Menu:

  • Search for "Battery Charge Limiter" in your applications menu
  • Or run: battery-limiter-gui

Features:

  • Real-time Display: Shows current charge limit and battery information
  • Easy Controls: Drag slider or use preset buttons (60%, 80%, 90%)
  • System Tray: Minimizes to system tray for convenient access
  • Quick Actions: Right-click tray icon for instant limit changes
  • Visual Feedback: Clear status indicators and notifications

⌨️ Command Line Interface

Basic Usage:

battery-limiter 80          # Set charge limit to 80%
battery-limiter 60          # Set charge limit to 60%
battery-limiter --info 90   # Show battery info and set to 90%

Examples:

# Set conservative limit for maximum lifespan
battery-limiter 60

# Set balanced limit for daily use  
battery-limiter 80

# Set extended limit for travel days
battery-limiter 90

# Check current battery information
battery-limiter --info 80

🎯 Recommended Limits

  • 60% (Conservative): Maximum battery lifespan, ideal for plugged-in workstations
  • 80% (Balanced): Good compromise between lifespan and capacity, recommended for daily use
  • 90% (Extended): Slightly reduced lifespan but more capacity for travel/mobility

🗑️ Uninstallation

To remove the Battery Charge Limiter from your system:

sudo bash uninstall.sh

💻 Compatibility

This utility attempts to automatically detect the battery charge control file on your system. It looks for common paths like /sys/class/power_supply/BAT*/charge_control_end_threshold and charge_stop_threshold.

Your laptop needs to expose this functionality via sysfs for this utility to work. Many modern ASUS, Lenovo, and Dell laptops support this. If the utility does not work, your hardware might not be compatible or might use a different path.

🤝 Contributing

Contributions are welcome! If you found a bug, have a suggestion for improvement, or want to add support for new hardware, please open an issue or submit a Pull Request.

📄 License

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

💖 Support the Project

If this project was helpful to you, please consider supporting its development:

☕ Buy me a coffee

🪙 Bitcoin

To donate, copy the address below:

1Lyy8GJignLbTUoTkR1HKSe8VTkzAvBMLm

Keywords: linux, battery, charge limit, threshold, laptop, asus, lenovo, dell, sysfs, systemd, power management, battery health, lifespan, conservation mode

About

Modern GUI and CLI utility to limit battery charging on Linux laptops, extending battery lifespan

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •