Locking the screen when laptop lid is shut (Gnome 3.8, Fedora 19)

6,942

Solution 1

From this answer: https://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.

Solution 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:
6,942

Related videos on Youtube

Abhinav Jayaram
Author by

Abhinav Jayaram

Updated on September 18, 2022

Comments

  • Abhinav Jayaram
    Abhinav Jayaram over 1 year

    I cannot 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.

  • slm
    slm almost 11 years
    Don't know if it matters but he's on Fedora.
  • slm
    slm almost 11 years
    Releated: forums.fedoraforum.org/showthread.php?t=292190. That variable can also take the value lock.
  • slm
    slm almost 11 years
    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.
  • Abhinav Jayaram
    Abhinav Jayaram almost 11 years
    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.