Ubuntu – How to tell Ubuntu to do nothing when I close the laptop lid


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

Best Answer

  • For 13.10 - 18.04:

    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. If HandleLidSwitch is not set to ignore then change it:


      (make sure it's not commented out or add if missing),

    3. Restart the systemd daemon (be aware that this will log you off) with this command:

      sudo systemctl restart systemd-logind

      or, from 15.04 onwards:

      sudo service systemd-logind restart

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

    For GNOME Users:

    If you are using GNOME (the default in 18.04+), then you can do this easily without changing system settings by using the "Gnome Tweak Tool". It can be installed from the Ubuntu Software Store (It is called GNOME Tweaks). Or if you prefer the console: sudo apt-get install gnome-tweak-tool

    Run it after installing, then under Power, Turn off the setting to do nothing when lid is closed. I tested this on Ubuntu 18.04 and it works.