Sign up ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

what is the most straightforward way to lock the screen AND suspend when closing the lid? I'm using event hooks in /etc/systemd/logind.conf and successfully suspend upon closing the lid. However I'm lost when it comes to the locking part - am I supposed to enable some screensaver service and how can I trigger two events at once in logind.conf?

share|improve this question

1 Answer 1

up vote 10 down vote accepted

There are a couple of examples on the Arch Wiki systemd page.

Basically, it involves creating a service file for your screen locker and ensuring it is hooked to either the suspend, hibernate or sleep targets.

If you use a simple screen locker like slock, your file would look like this:

Description=Lock the screen on resume from suspend



Other examples on the wiki have more complex options, including shutting down and bringing up other services, etc.

share|improve this answer
Thanks, I saw that example but did not realize the ExecStart=/usr/bin/slock bit refers to locking at first glimpse. – pldimitrov Jul 5 '13 at 1:24

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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