How to prevent screen locking when lid is closed?

I have Ubuntu 11.10 with Gnome 3 (no Unity), gnome-screen-saver has been removed and replaced with xscreensaver. The screensaver stuff all works fine -- no complaints there. When I close my laptop lid, even for a second, the screen locks (and the dialog box asking for my password is xscreensaver's). I'd like for this not to happen...

Things I've tried/looked at already:

  • xscreensaver settings - the "Lock Screen After" checkbox is not checked (though I've also tried it checked and set to 720 minutes)
  • gconf-editor - apps -> gnome-screensaver -> lock_enabled is not checked
  • System Settings -> Power - "When the lid is closed" is set to "Do nothing" for both battery and A/C
  • System Settings -> Screen - Lock is "off"
  • gconf-editor - apps -> gnome-power-manager -> buttons -> lid_ac && lid_battery are both set to "nothing"

  • dconf-editor - apps -> org -> gnome -> desktop -> screensaver -> lock_enabled is not checked

Output from: gsettings list-recursively org.gnome.settings-daemon.plugins.power:

org.gnome.settings-daemon.plugins.power active true
org.gnome.settings-daemon.plugins.power button-hibernate 'hibernate'
org.gnome.settings-daemon.plugins.power button-power 'suspend'
org.gnome.settings-daemon.plugins.power button-sleep 'suspend'
org.gnome.settings-daemon.plugins.power button-suspend 'suspend'
org.gnome.settings-daemon.plugins.power critical-battery-action 'hibernate'
org.gnome.settings-daemon.plugins.power idle-brightness 30
org.gnome.settings-daemon.plugins.power idle-dim-ac false
org.gnome.settings-daemon.plugins.power idle-dim-battery true
org.gnome.settings-daemon.plugins.power idle-dim-time 10
org.gnome.settings-daemon.plugins.power lid-close-ac-action 'nothing'
org.gnome.settings-daemon.plugins.power lid-close-battery-action 'nothing'
org.gnome.settings-daemon.plugins.power notify-perhaps-recall true
org.gnome.settings-daemon.plugins.power percentage-action 2
org.gnome.settings-daemon.plugins.power percentage-critical 3
org.gnome.settings-daemon.plugins.power percentage-low 10
org.gnome.settings-daemon.plugins.power priority 1
org.gnome.settings-daemon.plugins.power sleep-display-ac 600
org.gnome.settings-daemon.plugins.power sleep-display-battery 600
org.gnome.settings-daemon.plugins.power sleep-inactive-ac false
org.gnome.settings-daemon.plugins.power sleep-inactive-ac-timeout 0
org.gnome.settings-daemon.plugins.power sleep-inactive-ac-type 'suspend'
org.gnome.settings-daemon.plugins.power sleep-inactive-battery true
org.gnome.settings-daemon.plugins.power sleep-inactive-battery-timeout 0
org.gnome.settings-daemon.plugins.power sleep-inactive-battery-type 'suspend'
org.gnome.settings-daemon.plugins.power time-action 120
org.gnome.settings-daemon.plugins.power time-critical 300
org.gnome.settings-daemon.plugins.power time-low 1200
org.gnome.settings-daemon.plugins.power use-time-for-policy true

gnome-settings-daemon is running:

<~> $ ps -ef | grep gnome-settings-daemon
1000      1719  1645  0 19:37 ?        00:00:01 /usr/lib/gnome-settings-daemon/gnome-settings-daemon
1000      1726     1  0 19:37 ?        00:00:00 /usr/lib/gnome-settings-daemon/gsd-printer
1000      1774  1645  0 19:37 ?        00:00:00 /usr/lib/gnome-settings-daemon/gnome-fallback-mount-helper

Anything else I can check? Thanks!


I managed to figure out a workaround, though I imagine there's a better solution out there. I looked at what was happening when my lid was closed and opened in /etc/acpi/lid.sh and found that xscreensaver was being called upon automatically. Not sure if different laptops have different settings and whatnot - I really don't know too much about this stuff.

In any case, I tried to make it simply obey its config file and not lock, but couldn't figure it out, so I ended up simply deleting the lines that involved xscreensaver. Now everything works great: no locking, and if the lid is closed passed the amount of time which you have set for xscreensaver to start, it'll start normally (and not lock).

I'm still not sure why xscreensaver is set up to be called automatically when the lid is closed or why it ignores its settings and locks when the lid is opened. I also don't get why with my older laptop this only happens sporadically (sometimes it locks every time, sometimes not at all), despite having the same lid.sh file.

I should also note that I'm using Ubuntu 12.04 with Unity, though I don't think that'll make any difference.


I'm running Ubuntu 12.04 Classic (meaning Unity, I think), and had the same trouble. Here's what I wanted: When the screen is not locked, closing and reopening the lid should not cause the screen to lock.

This is easily achievable by dconf-editor; simply browse to org > gnome > desktop > screensaver and uncheck the lock-enabled entry.

PS: It seems easy to do, but the answer was hard to find.


Since GTK3 i have used

gsettings set org.gnome.desktop.lockdown disable-lock-screen 'true'

This will prevent all lock-screens. If you still want to be able to lock the screen you can use 'Switch User Account...' as a substitute. For 11.10, just set up a keyboard shortcut for the command

gdmflexiserver -xnest

For 12.04+ its

dm-tool switch-to-greeter

I am running Gnome Classic on 12.04, and Aibara Iduas's answer didn't work for me, but lead me to the answer. I had to edit /usr/share/acpi-support/screenblank, removing references in it to xscreensaver.