You are not logged in.

#1 2014-05-06 09:11:41

nzdave
Member
From: Wellington, New Zealand
Registered: 2014-05-06
Posts: 7

Laptop Auto Suspend

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

#2 2014-05-06 10:44:46

zezadas
Member
Registered: 2013-04-11
Posts: 35

Re: Laptop Auto Suspend

Search for laptop mode tools and see if there is any configuration related

https://wiki.archlinux.org/index.php/Laptop_Mode_Tools

Offline

#3 2014-05-07 06:19:45

nzdave
Member
From: Wellington, New Zealand
Registered: 2014-05-06
Posts: 7

Re: Laptop Auto Suspend

Thanks, will check it out

Offline

#4 2014-05-10 00:14:00

Name Taken
Banned
Registered: 2014-04-09
Posts: 113

Re: Laptop Auto Suspend

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

#5 2014-06-07 10:30:23

nzdave
Member
From: Wellington, New Zealand
Registered: 2014-05-06
Posts: 7

Re: Laptop Auto Suspend

Thanks
Was running this, but didn't realise it had that functionality.

Offline

Board footer

Powered by FluxBB