6

In Ubuntu 18.04 server I want to be able to shut the lid of my laptop and have the following happen:

  • The screen turns off.
  • The laptop itself keeps running and does not go to sleep.

If I set this in /etc/systemd/logind.conf

HandleLidSwitch=ignore

It achieves the second goal, but not the first (the screen stays on). Setting “lock” instead of “ignore” didn’t help either.

Daniel Porteous
  • 210
  • 1
  • 2
  • 9

1 Answers1

0

Years later, I have an answer for this.

Firstly, you want to do what I mention in the original post to make closing the lid not make the laptop sleep:

HandleLidSwitch=ignore

Secondly, you want to turn your screen off by putting something like this in your crontab (sudo crontab -e):

@reboot echo 0 | tee /sys/class/backlight/intel_backlight/brightness

This command turns the screen brightness to zero. @reboot means it'll run on system startup.

If this command doesn't work for you, try another of the commands in this stackoverflow answer.

Daniel Porteous
  • 210
  • 1
  • 2
  • 9