Take the 2-minute tour ×
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.

I cannot for the love of god figure out how to configure the screensaver to be run (which in turn causes the screen to be locked) every time I shut the lid of my laptop. I have xscreensaver installed and on Xfce it allowed me to configure an action when the lid is shut. Well, not on Gnome 3 :-( Any ideas?

Edit: I do not want the computer to suspend/hibernate when I shut the lid; simply blank the screen.

share|improve this question

2 Answers 2

in your /etc/systemd/logind.conf file, add the line

HandleLidSwitch=suspend

or if that doesn't work,

HandleLidSwitch=hibernate

Source: http://www.freedesktop.org/software/systemd/man/logind.conf.html

share|improve this answer
    
Don't know if it matters but he's on Fedora. –  slm Aug 15 '13 at 16:16
    
Releated: forums.fedoraforum.org/showthread.php?t=292190. That variable can also take the value lock. –  slm Aug 15 '13 at 16:23
    
Agreed that comment was more to guard you if others come along in the future and see the difference they'll know that it was already addressed by your follow-up comment. I also provided a link to fedoraforum with the same solution for added protection. –  slm Aug 15 '13 at 16:25
    
Yes, that would work if I wanted the machine to suspend. But I simply want to blank the screen and lock it at the same time when I shut the lid, not suspend. –  mart1n Aug 16 '13 at 7:52

From this answer: http://superuser.com/questions/748482/how-to-suspend-from-lockscreen-in-gnome-3 , in your /etc/systemd/logind.conf change the line to:

HandleLidSwitch=lock

and then sudo systemctl restart systemd-logind to restart the service.

share|improve this answer

Your Answer

 
discard

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.