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.
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:
Secondly, you want to turn your screen off by putting something like this in your crontab (
sudo crontab -e
):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.