Revision of Create a Virtual Monitor Power Button from Thu, 12/13/2007 - 21:30

A friend had an interesting problem for me to solve; he wanted to know how to turn off his laptop’s monitor without shutting down the system or waiting for it to go off. He wanted to leave it working during the night on the desk in his room, without the light from the LCD bothering him while he slept.

Luckily there is a Linux command to do just about anything. To turn off your monitor from a terminal, run this command:

sleep 1 && xset dpms force off

Moving the mouse or pressing a key will turn the monitor back on.

The sleep 1 (wait for one second) is needed only when you are typing the command in a terminal. This is because the command is executed as soon as the enter key is pressed, when it lifts up X turns the monitor back on.

The xset command is used for setting X display preferences. In this case it uses VESA Display Power Management Signaling to turn off the monitor.

You can create a desktop or panel launcher to do the same thing.

Turn off your monitor

Right click on the desktop and select Create Launcher. Use the command xset dpms force off, give it a name, and choose a nice icon. You can also drag it on to your panel for convenient access.