Turning off your screens in one click or with a hot key

I like to save energy and spare my laptop of unnecessary strains, and I sometimes get annoyed when I leave my computer for a break and only come back in my office to see that my three screens are still on with full luminosity. Of course I could set an automatic screensaver timing, but I also find that annoying because it gets triggered while I'm watching a video.

Command to turn off screens

If you, like me, enjoy being able to turn off all your screens in one click, here is a very simple solution:

Download and unpack this script file and place it on your desktop.

All it does is run this command:

sleep 2 && xset dpms force off

This will turn off all your screens within two seconds.

If you double click on the file, you should get a prompt asking you what you want to do with it, click on Run or Run in terminal.

The file should be set as executable, if it is not, you can set it up manually:

sudo chmod a+x /home/myUsername/Desktop/screenOff.sh

change the path to the folder where you have downloaded the script.

Using a hot key

If, instead of clicking on your desktop file, you'd like to set up a hot key. Go to System > Preferences > Keyboard Shortcuts
and click on "+ Add".
Type a name, such as:

Turn off screen

Now, I have noticed on my machine that if you enter the following line in the command field:
sleep 2 && xset dpms force off

It doesn't get triggered.
but instead if you enter:
/home/myUsername/Desktop/screenOff.sh

the screens are turned off after 2 seconds. Again, change the path to yours.

Your new Action will appear at the bottom of the window, inside "Custom Shortcuts".
On the right of the line, you will see under the "Shortcut" column "Disabled".
Click on it, and then press the shortcut key you would like to assign to it. Make sure it isn't already used.

Comments

I admire the awesome

I admire the awesome information you offer in your articles. I will bookmark your blog and have my children check up here often. I am quite sure they will learn lots of new stuff here than anybody else!
http://www.site-de-paris-en-ligne.fr

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

More information about formatting options


CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
4 + 5 =
Solve this simple math problem and enter the result. E.g. for 1+3, enter 4.