How do you disable the Laptop Lid Switch in Ubuntu 20.04? [duplicate]

Is there a way to just stop the OS from using the Laptop Lid Switch all together, regardless of what you want to happen?

If not, I want to close the lid and open it with out having to log back in.


Solution 1:

This is taken from a previous answer and it works: How can I tell Ubuntu to do nothing when I close my laptop lid?

In summary:

  1. Put this into the terminal:

    sudo -H gedit /etc/systemd/logind.conf
    
  2. Find the line that says:

    #HandleLidSwitchDocked=ignore
    
  3. Remove the # at the beginning (i.e. uncomment it), and save the file.

  4. Then type:

    sudo systemctl restart systemd-logind
    

When it restarts, you should find that shutting the lid turns the screen off, but leaves you logged in.

I hope that helps.