Battery life is one of the main concerns for those who use portable with Linux, especially if you use KDE or GNOME desktops. Limiting battery charge to 80% is a key strategy for extending the life of lithium batteries, preventing the premature degradation that occurs when maintaining constant full charges.
In this article I bring you the most complete and updated guide to control the maximum battery charge in Linux, exploring both built-in tools and custom scripts, configurations for specific models, and tips for everyday laptop users. If you're frustrated by your laptop's rapid loss of capacity or just want to take care of it from the start, read on.
Why limit battery charge to 80%?
Lithium-ion batteries, present in most current laptops, They suffer accelerated wear if they are constantly kept at 100% load. Manufacturers like ASUS, Lenovo or Dell includes utilities in Windows to limit the maximum load and thus protect the hardware, but in Linux this function is not always accessible via a graphical interface.
Limiting the maximum charge to 80% (or whatever the manufacturer recommends) helps keep the battery in good condition for more charge-discharge cycles., avoiding drastic capacity losses over the months.
From the KDE Plasma and GNOME desktop environments
To do this in these desktop environments, just follow these steps, starting with KDE Plasma:
- Go to System Settings.
- See System > Power Management.
- Then click on Advanced Power Settings.
- In Charge Limit, you can set the limits you want.
- I recommend that they be Stop charging at: 80% and Start charging once below: 40%.
- Apply. And that's it.
In the case of GNOME, the steps are:
- Install the Battery Health Charging extension, compatible with various laptop brands such as ASUS, Acer, Lenovo, Dell, LG, etc.
- Enable Polkit.
- Once done, you can see the new extension in the system tray.
- You have three modes: Full Capacity, Balanced, and Maximum Lifespan. All three allow you to adjust the values from the Threshold.
Native Options and Manufacturer Support in Linux
Some manufacturers offer Windows-only applications to manage the battery. One example is MyASUS, which allows you to choose optimal charging profiles. However, if you removed Windows or your model isn't compatible, you'll have to look for alternatives. Some laptops, especially Lenovo ThinkPads, allow you to control load limits using software in Linux.
- ThinkPad: you can install TLP and the module acpi_call. TLP is an advanced power management tool for Linux that allows you to define load thresholds in the configuration file. For more details, see this Article on battery management in Linux.
- Other models: Some manufacturers allow you to change the load limits by accessing the BIOS/UEFI, while others have no direct way to do so outside of Windows.
If you have any questions, consult your brand's official documentation or search specialized forums.
Recommended tools on Linux: TLP and acpi_call
For compatible models, the use of TLP combined with acpi_call It's the best solution for automating load limits. Here's how it works:
- Install the necessary packages:
sudo apt install tlp acpi-call-dkms
(on Debian/Ubuntu based distributions)
sudo pacman -S tlp acpi_call
(for ArchLinux and derivatives) - Edit the configuration file:
Opens/etc/default/tlp
with your favorite editor and look for the following lines:
START_CHARGE_THRESH_BAT0=55
STOP_CHARGE_THRESH_BAT0=80
Adjust the values according to your preference or your manufacturer's recommendation. For example, to charge up to 80%, you can set START to 58 and STOP to 80 (the values may require testing depending on your hardware). You can also see tips in explanatory videos at YouTube for better configuration. - Restart the TLP service to apply the changes:
sudo tlp start
The system will automatically manage the start and end of charging according to the defined thresholds.
What happens when the battery reaches the minimum and maximum limits?
Many users wonder what happens when a load limit is set. In most configurations, If the battery exceeds the maximum limit, charging stops and the power supply switches to directly supplying the laptop.When the charge drops below the minimum threshold, the system allows the battery to be recharged. This behavior is key to reducing wear and optimizing component health.
This feature is especially interesting because Avoid the constant charge-discharge cycle if you use the laptop connected to the power supplyThis way, the battery remains within safe limits and the equipment continues to operate normally.
Universal Alternatives: Battery Monitoring and Notification Scripts
Not all laptops allow you to limit the battery life from the UEFI or with tools like TLP. If this is your case, you can use custom scripts that Monitor the battery status and notify you when to connect or disconnect the chargerAlthough they are not an automatic solution, they are a great help with manual care.
Bash script example for battery alerts
You can create a small bash script that uses the tool acpi to check the battery percentage and notify-send to display notifications in KDE or GNOME. This type of script periodically checks the battery status and displays messages when a defined threshold is reached:
#!/bin/bash while true do bat_level=`acpi -b | grep -oP '+(?=%)'` if ; then notify-send "Battery at 80% or more" "Unplug the charger. Current level: ${bat_level}%" elif ; then notify-send "Battery low (20%)" "Connect the charger. Current level: ${bat_level}%" fi sleep 600 # Check every 10 minutes done
You can save the script, give it execution permissions and launch it at login, so you'll always have important warnings to connect or disconnect the charger before the battery deteriorates completely.
Constant monitoring: use of cron and customization
If you prefer even more flexible control, you can schedule the script to run automatically using cron
or integrate the check into systemdA classic example is to add a task to the crontab that triggers the check every few minutes:
* * * * * /path/to/script/battery_notification.sh
This method is ideal for users with distros like ArchLinux that do not have a traditional crontab, although you can always install crony to manage recurring tasks.
Additional battery care in Linux
Beyond the load limits, there are a number of general recommendations for Extend battery life on Linux laptops:
- Avoid prolonged exposure to excessive heat, as it Temperature is one of the factors that most degrades the battery.
- Be careful not to discharge the battery completely. Deep discharge cycles can be harmful in the long run..
- Performs complete charge and discharge cycles every 30 or 50 cycles to ensure calibration of the battery indicator.
- Use cooling pads or raise your laptop to improve air circulation underneath.
Special cases: brand limitations and alternatives
While brands like Lenovo facilitate advanced management through TLP, other manufacturers like ASUS limit functionality to Windows and do not provide equivalent modules in Linux. In these cases, A temporary solution is to set the upload limit from Windows, if you have double Boot, since some systems record the configuration in the BIOS/UEFI and respect it when booting LinuxHowever, this option does not guarantee operation on all models and may require testing.
The lack of support from some brands for Linux users remains an outstanding issue, although communities continue to develop alternative solutions.
Passionate writer about the world of bytes and technology in general. I love sharing my knowledge through writing, and that's what I'll do on this blog, show you all the most interesting things about gadgets, software, hardware, tech trends, and more. My goal is to help you navigate the digital world in a simple and entertaining way.