Quick Hint: How to save energy in Linux by turing your screen off when locking

Hi!

In my office I frequently lock my screen when I leave my desk. I found out, after pressing the Screen locking shortcut in Ubuntu 13.04 (and the versions before) the screen goes black but is still turned on and therefor consumes more energy than necessary. I hate wasting resources (and battery life) so I began to look for a solution…

After a while I came up with one bash line and a custom keyboard shortcut which solves the problem. I’ve been using it without problems for the past few weeks.

The Script

First, you setup a new bash script called „screenoff.sh“ in your home directory (~) which contains the following:

#!/bin/bash
xset dpms force off; gnome-screensaver-command -l

The Keyboard Shortcut

After your script is in place you have to define a keyboard shortcut (screenshot from Ubuntu 13.04)

keyboard_shortcut

Here you execute your newly written script:

bash "~/screenoff.sh"

And voilà! Every time you now hit your defined shortcut, you can now turn off AND lock your screen.

[poll id=“8″]

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert

I accept that my given data and my IP address is sent to a server in the USA only for the purpose of spam prevention through the Akismet program.More information on Akismet and GDPR.

Diese Website verwendet Akismet, um Spam zu reduzieren. Erfahre mehr darüber, wie deine Kommentardaten verarbeitet werden.