5

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.

Archisman Panigrahi
  • 28,338
  • 18
  • 105
  • 212
OldMan
  • 61
  • 1
  • 4

1 Answers1

7

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.

Will
  • 2,292
  • 2
    It's better to close the question as a duplicate since the question and answer are exactly the same. By answering duplicate questions that have already been asked and answered elsewhere, it makes our site more difficult to navigate. For example, if future visitors search Ask Ubuntu for the answer to this question, it would be a disservice for them to land on this question, since it does not contain as much information. Even in the case of someone finding both questions, having information spread among multiple identical questions makes the information hard to access. – Nmath Aug 14 '21 at 22:58
  • 1
    Thanks - and apologies for any disservice - completely unintentional and understood. I’d have preferred to put a comment in referencing the previous answer but can’t comment as yet so thought an answer with the link was the best I could do. Please feel free to convert my answer to a comment if that is better for the site. – Will Aug 14 '21 at 23:15
  • 3
    @Will: In my opinion offering the OP a specific answer to their question is better than referring them to a ten year old question with 25 different answers and no hint on which to try first. You now have a high enough reputation to comment anywhere. – C.S.Cameron Aug 15 '21 at 03:44
  • 2
    Thank you Will. So many answers for non 21.04 version, I had to remove the # . THANKS! Issue Resolved. – OldMan Aug 15 '21 at 14:07
  • 2
    @OldMan - you’re vert welcome, pleased I could help. I guess you do need to be mindful that your battery will run down faster when you shut the lid than it would have done. C.S.Cameron - thank you for that. The different views on this site is one of the reasons I think it works so well. I think I might pop a question on meta on the subject of how to answer questions when there’s a very old answer/answers! – Will Aug 15 '21 at 17:14