I recently made the switch to dwm as the default window-manager on my laptop. It being a no frills software, I had to configure a few things that I usually don't have to worry about.

While I got most things to work, I can't seem to figure out a foolproof way to lock the screen on the laptop. Currently, I have a partially working solution using a program called xautolock. Which manages to lock the screen after a specified timeout. But it fails to lock the screen after wake-up. Which is important to me.

 xautolock -time 10 -locker slock

Any ideas?

  • have you tried xssstate or xss (links available on suckless.org) – PinkFloyd Oct 15 '15 at 12:20
  • 1
    If you use systemd, you can have a service file that locks the screen on wakeup. – jasonwryan Oct 15 '15 at 20:53
  • and if you don't use systemd, you can run a script on suspend/hibernate using the pm-utils package. – meuh Oct 17 '15 at 14:24
  • @jasonwryan Yup. Creating a systemd service fixed the problem. – feverDream Oct 17 '15 at 19:38
  • You should post your service as an answer and accept it: it will help someone else who stumbles on this via a search. – jasonwryan Oct 17 '15 at 19:42

Creating a separate systemd service seems like a clean way to solve the problem. Also on a system running sysinit one can launch slock using suspend/resume hooks.

Description=Lock the screen on resume from suspend


  • 1
    Nice username :) – jasonwryan Oct 17 '15 at 19:47

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.