0

After recently switching to i3 in Arch, I need something to manage power. xautolock seemed to be a good choice.

Unfortunately, I need it to do both systemctl suspend and i3lock at the same time, but it cannot achieve that.

Eg.

exec_always xautolock -time 3 -locker "i3lock && systemctl suspend"

That does not work at all, after i3lock is triggered, suspend won't happen.

Interesting though, the fact that this:

bindsym $mod+Control+s exec --no-startup-id i3lock && systemctl suspend

Actually works, after pressing the binding, i3locks screen and system is suspended.

Please let me know if xautolock can achieve the same thing, and what options will I need to add in order for it to work.

Thank you for taking the time for a look!

And just as a side note,

exec_always xautolock -time 3 -locker “systemctl suspend”

Works, but it only suspends machine and not lock it.

1
1

Probably this is not the perfect answer but is a workaround

i wanted this to run:

exec_always xautolock -time 1 -locker "i3lock && xset dpms force off"

But it didn't.

After reading a liitle bit the xautolock manual I tried this:

exec_always xautolock -time 1 -locker "i3lock" -killtime 1 -killer "xset dpms force off"

That didn't run also... So finnaly tried this:

exec_always xautolock -time 1 -locker "xset dpms force off" -notify 5 -notifier "i3lock -n -c 0E1621"

That seems to be working.

See also if you want using xautolock and i3lock to lock/suspend after inactivity

Hope that this may help you!

1
  • This does work, but I feel like it is easier to just write a script, that way customization is also more convenient. – Asmodean Jan 25 at 3:04
0

So here was what I did.

I have yet to configure things like the color or pictures but this worked.

#Power Management
set $suspend /home/user/suspend/suspend.sh
exec_always --no-startup-id xautolock -time 1 -locker "sh $suspend"

This points the i3lock to use a script, btw, the sh is needed to make this work

Then you make a script at the location specified above.

!#/bin/bash
i3lock
systemctl suspend

With this content. Customize it as you want, and you are good to go!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.