Stops charging you laptop when it reaches 60% charge.
To install, run:
curl -sL "https://git.io/JWbU9" | sudo tee /etc/systemd/system/chargelimit.service
sudo systemctl start chargelimit # set limit till next system restart
sudo systemctl enable chargelimit # set limit automatically every time system restarts Keeping your battery's charge between 40% and 60% will improve it's lifespan and capacity.
Note: You should disable the limit, and let your battery charge to 100% and then completely discharge once every 4-5 months.
Open the /etc/systemd/system/chargelimit.service file in a text-editor of your choice, go to line 8, and replace 60 with your preferred value.
Use sudo to open if it says permission denied.
To remove the limit, run:
sudo systemctl stop chargelimit # removes limit till next system restart
sudo systemctl disable chargelimit # removes limit till you manually turn it back onYou may also remove the systemd service file if you want to completely uninstall the program:
sudo rm /etc/systemd/system/chargelimit.service
You can write your preferred charge limit to this file: /sys/class/power_supply/BAT0/charge_control_end_threshold, and the kernel stops charging the battery when it's at the limit.
But the value you write is reset to 100 when your laptop restarts. This program uses systemd-services to write the limit to the file every time your computer restarts.
Read more about systemd services
Everything in this repository is released into public domain and is using Unlicense.
This is one of those one-off repositories that should probably be a gist. If you have any questions or ideas for improvement, feel free to create an issue or a pull request :)