How to setup automatic suspend - battery settings in i3wm

How do you set up your laptop to suspend in i3wm?

Usually in xfce I do it in system settings under battery settings. I like it to suspend automatically after 20 min unused on battery. Thanks for any inputs/ideas!

Take a look at logind (/etc/systemd/logind.conf):

thanks for the tip!

HandlePowerKey=hibernate
#HandleSuspendKey=suspend
#HandleHibernateKey=hibernate
HandleLidSwitch=suspend
...
HoldoffTimeoutSec=30s
IdleAction=hybrid-sleep
IdleActionSec=30min

can use this also in config file

exec --no-startup-id xautolock -time 60 -locker "systemctl suspend"

can set the timer as you want
has to install xautolock first

2 Likes

I like this one, will try it! :+1:

1 Like