Post

Prevent Laptop from Turning Off the Screen When Lid is Closed

Instructions to keep your laptop screen on when closed.

Prevent Laptop from Turning Off the Screen When Lid is Closed

This guide explains how to disable the screen from turning off when the laptop lid is closed on a remote machine.

⚠️ Important: Do this over SSH! ⚠️

Step 1: Modify logind configuration

Open the logind.conf file with a text editor like nano:

1
sudo nano /etc/systemd/logind.conf

Add or modify the following lines:

1
2
HandleLidSwitch=ignore
HandleLidSwitchDocked=ignore

Step 2: Restart systemd-logind

To apply the changes, restart the systemd-logind service:

1
sudo systemctl restart systemd-logind

Step 3: Install vbetool

Install vbetool to control the display power management:

1
sudo apt install vbetool

Step 4: Manually Turn Off/On the Display

To turn off the display:

1
vbetool dpms off

To turn it back on:

1
vbetool dpms on

Now, the display will no longer automatically turn off when the lid is closed.

This post is licensed under CC BY 4.0 by the author.