You are not logged in.
Pages: 1
Hi,
I was looking to get my laptop to auto suspend once the battery got to 5%
I had a look at:
https://wiki.archlinux.org/index.php/La … tery_level
Sadly my T430 doesn't send udev events for each % of battery that drops.
So i hacked this together.
/usr/local/bin/lowbattcheck.sh:
#!/bin/bash
if [ $(cat /sys/class/power_supply/BAT0/status) = Discharging ] && [ $(cat /sys/class/power_supply/BAT0/capacity) -lt 5 ]
then /usr/bin/systemctl suspend
fi
/etc/systemd/system/lowbatt.service:
[Unit]
Description=Low Battery Auto-Suspend
[Service]
Type=simple
RestartSec=60
Restart=always
ExecStart=/usr/local/bin/lowbattcheck.sh
[Install]
WantedBy=multi-user.target
It seems to work alright on my Lenovo T430 and Asus eee 901
Was interested to see if anyone had a smarter way of doing it, or if it was worth sticking it on the wiki for others to use.
Cheers
Offline
Search for laptop mode tools and see if there is any configuration related
Offline
Thanks, will check it out
Offline
This app can do the same thing while also displaying an indicator in your tray.
https://www.archlinux.org/packages/comm … cbatticon/
https://github.com/valr/cbatticon
Last edited by Name Taken (2014-05-10 00:18:40)
Offline
Thanks
Was running this, but didn't realise it had that functionality.
Offline
Pages: 1