Feb 24

How to switch of the screen

Category: Linux,Ubuntu   — Published by goeszen on February 24, 2015 at 7:00 pm

Very often, when you hear music or go away, your machine will first idle for a few minutes (whatever your screensaver is set to), then go to screen-saver mode and in case you have that set, after a few minutes your screen / LCD / monitor will completely shutdown, mostly first the LCD backlight, followed by the screen actually switching itself off. But it doesn have to be that way: you can turn off your screen immediately. On Ubuntu, you probably have DPMS (Display Power Management Signaling) working, and you can force it to shutdown the screen immediately:

xset dpms force off

(via here and here)

This is especially handy if you want to save battery on a laptop, or when you need/want the display to go completely dark immediately.

For extra comfortable firing of this command, let's create a desktop launcher, Unity icon for it (more on that here,  with GUI here or with a Ubuntu app here:

The manual way to create a launcher is pretty well described here.
Create a file with these contents:

#!/usr/bin/env xdg-open
[Desktop Entry]
Version=1.0
Type=Application
Terminal=false
Icon[en_EN]=disable-device
Name[en_EN]=xoff
Comment[en_EN]=switch off / turn off screen
Exec=xset dpms force off
Name=xoff
Comment=switch off / turn off screen
Icon=disable-device

or do this: $ gnome-desktop-item-edit ~/Desktop/xoff.desktop --create-new

Add the executable bit: $ sudo chmod +x ~/Desktop/xoff.desktop

And in case you've created the launcher in the .desktop file directory /home/<username>/.local/share/applications/,
update the Unity / launcher database with: $ sudo updatedb

 

Leave a Reply

=