Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I would like closing the laptop lid to be a no-op. How can I do that?

share|improve this question
add comment

10 Answers

up vote 18 down vote accepted

For 13.10:

To make Ubuntu do nothing when laptop lid is closed:

  1. Open the /etc/systemd/logind.conf file in a text editor as root, for example,

    sudo -H gedit /etc/systemd/logind.conf
    
  2. Add a line HandleLidSwitch=ignore (make sure it's not commented out!),
  3. Restart the systemd daemon with this command:

    sudo restart systemd-logind
    

See also: Ubuntu Server 13.10 now goes to sleep when closing laptop lid

share|improve this answer
    
This didn't work for me. What finally solved it for me was setting IgnoreLid=true in /etc/UPower/UPower.conf –  Kimble Apr 2 at 14:10
    
HandleLidSwitch=hibernate if you want your laptop to hibernate instead of doing nothing. –  SalmanPK Apr 18 at 1:08
add comment

For 11.04 and earlier:

Do nothing when laptop lid is closed (helpful when an external monitor is connected):

  • Alt + F2 and enter this: gconf-editor
  • apps > gnome-power-manager > buttons
  • Set lid_ac and lid_battery to nothing

alt text

OR

1.When on AC Power, do nothing when laptop lid is closed:
gconftool-2 -t string -s /apps/gnome-power-manager/buttons/lid_ac nothing

2.When on Battery Power, do nothing when laptop lid is closed:
gconftool-2 -t string -s /apps/gnome-power-manager/buttons/lid_battery nothing


Blank screen when laptop lid is closed (preferable when no external monitor is connected):

  • System > Preferences > Power Management
  • On AC Power (On Battery Power) > Actions
  • When laptop lid is closed: Blank screen

alt text

OR

1.When on AC Power, blank screen when laptop lid is closed:
gconftool-2 -t string -s /apps/gnome-power-manager/buttons/lid_ac blank

2.When on Battery Power, blank screen when laptop lid is closed:
gconftool-2 -t string -s /apps/gnome-power-manager/buttons/lid_battery blank

share|improve this answer
    
+1 Now that's some answer –  Pitto Jan 16 '13 at 14:12
add comment

For 11.10 and newer:

You can select "Do Nothing" in the power settings. Open the dash (super key), search for "power" and then select the correct option in the dropdown. Note that closing the lid will actually turn off the screen though plus any external monitors:

enter image description here

If you move the mouse then any connected monitors will power back up with the laptop closed. This will then become the primary monitor.

share|improve this answer
2  
Yes, but this doesn't seem to work. I think it's a bug in 12.04. –  Thom Jun 17 '12 at 21:43
1  
Works for me on Ubuntu 12.04.1 LTS. –  Tgr Sep 6 '12 at 9:07
    
It is not working for me in Lubuntu 13.10 –  Sandeep Jindal Feb 13 at 17:45
    
working for my ubuntu 13.10 –  Ashish Feb 17 at 5:58
add comment

11.04 and previous versions

Copying 1st given answer from: http://ubuntuforums.org/showthread.php?t=1319921&highlight=close+laptop+lid

In a terminal (Applications-->Accessories-->Terminal), type: gconf-editor

Navigate to apps-->gnome-power-manager-->buttons and set lid_ac and/or lid_battery to "nothing" (without the quotes).

alt text

share|improve this answer
add comment

For Saucy:

Edit /etc/systemd/logind.conf and set HandleLidSwitch=lock to lock the screen on lid close (but not suspend), or HandleLidSwitch=ignore to not even lock the screen.

This is due to an upstream GNOME change. See GNOME bug 687277 for the rationale for this change.

share|improve this answer
    
Does ubuntu use systemd? –  Khurshid Alam Oct 16 '13 at 19:38
    
systemd is now many things. Ubuntu does not use systemd's init ("pid 1"), but it does use components that were formerly independent but are now absorbed into the systemd source, such as udev. So you will see mentions of the systemd name on an Ubuntu system, but that does not mean that its init system has suddenly changed. –  Robie Basak Oct 17 '13 at 8:14
add comment

11.04 and previous versions

you can also go to system->preferences->power management

near bottom of the window you will find a dropdown where you can select what your system does when lid is closed

share|improve this answer
add comment

12.04

In System Settings, open Brightness & Lock. On that page, uncheck the checkbox at the bottom that says, "Require my password when waking from suspend."

share|improve this answer
1  
Tried this and it made no difference. –  Thom Jun 17 '12 at 21:43
add comment

There is a bug with some laptops and monitors that makes Ubuntu not honor the "do nothing" setting when the laptop's lid is closed. I have not been able to find a complete solution, but maybe there is something to do with this link where they hint at this file : /etc/default/acpi-support and using:

gconftool-2 -t string /apps/gnome-power-manager/buttons/lid_ac -s "blank"
gconftool-2 -t string /apps/gnome-power-manager/buttons/lid_battery -s "blank"
share|improve this answer
add comment

For 12.10:

Edit /etc/UPower/UPower.conf and add IgnoreLid=true to the bottom.

This method no longer works in Saucy. I am unsure about 13.04.

share|improve this answer
add comment

I like to suspend my laptop sometimes, and other times I like to keep it going for long times like a server (do nothing when I close the lid). I use Debian, and here's my simple script to do either one on the fly without rebooting:

# run this in the as the same user (or root) that xwindow is using

# test for required parameter --> empty not allowed
if [ "$1" == "" ]; then
    echo "Please provide true or false"
    echo "True means keep running when lid is closed"
    echo "False means suspend the computer when lid is closed"
    exit;
fi

# "running true" means keep running even if the lid is closed
if [ "$1" = "true" ]; then
    gsettings set org.gnome.settings-daemon.plugins.power lid-close-ac-action nothing
    gsettings set org.gnome.settings-daemon.plugins.power lid-close-battery-action nothing
fi


# "running false" means suspend the computer!
if [ "$1" = "false" ]; then
    gsettings set org.gnome.settings-daemon.plugins.power lid-close-ac-action suspend
    gsettings set org.gnome.settings-daemon.plugins.power lid-close-battery-action suspend
fi

# if "echo" is supplied as a param, just show the current settings
if [ "$1" = "echo" ]; then
    gsettings get org.gnome.settings-daemon.plugins.power lid-close-ac-action
    gsettings get org.gnome.settings-daemon.plugins.power lid-close-battery-action 
fi

# restart gnome to make changes effective
/etc/init.d/gdm3 restart
share|improve this answer
add comment

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.