Created
May 17, 2022 18:07
-
-
Save saimonn/3a4be5f4dabb8ba94d4918cb58844aa7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This simple systemd unit sets battery thresholds to preserve battery life on Lenovo Thinkpad | |
# (works on T470 but might work for others models) | |
# | |
# use this command to create the unit file: | |
# | |
# systemctl edit --force --full battery_thresholds.service | |
# | |
# to enable the service and start it now, type: | |
# | |
# systemctl enable battery_thresholds.service --now | |
# | |
[Unit] | |
Description=Set battery thresholds to preserve battery life on Lenovo Thinkpad | |
After=network.target | |
RequiresMountsFor=/sys | |
[Service] | |
Type=oneshot | |
ExecStart=sh -c 'echo 85 > /sys/class/power_supply/BAT0/charge_control_end_threshold' | |
ExecStart=sh -c 'echo 85 > /sys/class/power_supply/BAT1/charge_control_end_threshold' | |
ExecStart=sh -c 'echo 30 > /sys/class/power_supply/BAT0/charge_control_start_threshold' | |
ExecStart=sh -c 'echo 30 > /sys/class/power_supply/BAT1/charge_control_start_threshold' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment