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:

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)


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.

Was this hint useful for you?

View Results

Loading ... Loading ...