A script to modify battery charging threshold for Linux Laptops.
Limiting laptop charging to 60% or 80% can extend your battery life if your prefer using it plugged in most of the time (I heared half charged battery lives the longest). Old laptops may not support this. The supported thresholds may differ for different vendors. ( I read somewhere some systems only supports 60%, 80% and 100%. So try these first.).
Credits goes here. Thanks linuxuprising.com.
After setting up the service, if you need to change the threshold value, you have to go and edit the systemd service file with superuser premission and reload the daemon and then restart the service. If I was on windows, I just have to move a slider. I don't know how I can create a slider like that here on Linux. So I tried this script.
First time users, this is all you have to do.
curl -sSf https://raw.githubusercontent.com/abinlatheef/Battery-Charge-Threshold-Modifier/main/install.sh | sudo sh
Provide the threshold value you and thats it. Done. Now go on with your things.
- Just take the bat_threshold.sh file and save it somewhere convenient.
- Run. (
./bat_threshold.sh
from the same directory). - It will ask you for your password. This for superuser permission to modify protected .service file.
- It will ask you for the new value. Give that.
- Done.!
Thanks for reading.See you soon.🤘
I have not tested this on other devices. So feel free to report any issues.