Tech Tip: Go Green On Your Screen(saver)
October 20th, 2009 by Sangeeth Keeriyadath in
I usually lock my screen when I leave my cubicle for a tea-break etc. With all the talk of saving energy these days I've disabled screen-savers on my system. Still, when I'd lock my screen I noticed that the LCD didn't turn off completely. Wanting to go as green as I could I wanted to switch off the LCD as well.
The following command does that:
xset dpms force off
When I press "Alt+Ctrl+L" (lock screen), the following command is invoked:
gnome-screensaver-command --lock
What I want now is to associate the following command with a different shortcut key:
gnome-screensaver-command --lock; xset dpms force off
So that I can lock as well as power off my LCD screen with a keyboard shortcut. To do this I installed xbindkeys to add a custom shortcut key. When you have xbindkeys installed create created the default config file:
xbindkeys --defaults > /home/your-user-name/.xbindkeysrc
Now assign a shortcut key. To do this you edit the config file (or if you prefer you can install xbindkeys-config) and append the following lines to the file:
# lock&blank "gnome-screensaver-command --lock; sleep 1; xset dpms force off;" alt+control+k
You also should remove all the enabled lines (comment them out), at least in my case they somehow interfered with my other shortcuts. I also had to add the sleep 1 between the commands to get it to work, perhaps due to compiz animation time.
Now, when I press "alt+control+k" I save power as well as lock my screen.
Tested on Ubuntu 8.10 running on Lenovo T61p.
__________________________
Special Magazine Offer -- Free Gift with Subscription
Receive a free digital copy of Linux Journal's System Administration Special Edition as well as instant online access to current and past issues. CLICK HERE for offer
Linux Journal: delivering readers the advice and inspiration they need to get the most out of their Linux systems since 1994.
Subscribe now!
The Latest
Newsletter
Tech Tip Videos
- Nov-19-09
- Nov-04-09
Recently Popular
From the Magazine
December 2009, #188
If last month's Infrastrucuture issue was too "big" for you then try on this month's Embedded issue. Find out how to use Player for programming mobile robots, build a humidity controller for your root cellar, find out how to reduce the boot time of your embedded system, and if you're new to embedded systems find out the basics that go into one. You can also read about the Beagle Board, the Mesh Potato and a spate of other interestingly named items. And along with our regular columns don't miss our new monthly column: Economy Size Geek.
Delicious
Digg
StumbleUpon
Reddit
Facebook








Why do screen(savers) don't really save ?
On October 30th, 2009 k.sangeeth says:
1. They consume more power than a switched off display(the calculation for this is pretty simple :) )
__________________________2. screensavers do consume some amount of CPU cycles.
3. Keeping the display switched on continuously may reduce it's lifetime.
Sangeeth Keeriyadath
www.sangeek.com
KDE
On October 26th, 2009 Mitch Frazier says:
For KDE do:
__________________________Mitch Frazier is an Associate Editor for Linux Journal and the Web Editor for linuxjournal.com.
> For KDE do: > dcop
On October 31st, 2009 Antonio (not verified) says:
> For KDE do:
> dcop kdesktop KScreensaverIface lock
> sleep 1
> xset dpms force off
NOOO
Since years ago KDE uses D-Bus, so it should be:
qdbus org.kde.krunner /ScreenSaver org.freedesktop.ScreenSaver.Lock; sleep 2s; xset dpms force offSee more in:
http://foss-boss.blogspot.com/2008/11/ride-d-bus-control-your-linux-desktop.html
Depends on which version of KDE you're using
On November 2nd, 2009 Mitch Frazier says:
If you're using KDE4 then yes, use dbus. If you're using KDE3, which I am, then no, use dcop. I should have mentioned that this was for KDE3.
__________________________Mitch Frazier is an Associate Editor for Linux Journal and the Web Editor for linuxjournal.com.
works in XFCE too
On October 21st, 2009 Mark Pettit (not verified) says:
Very neat. I also used the xscreensaver-command -lock;sleep 1;xset dpms force off, saving it into a text file, making it executable, and then configuring that as
a hot-key under XFCE (used linux-key + L). and blow me down, it worked.
Thanks
I just plugged my lcd's into
On October 21st, 2009 lowtech (not verified) says:
I just plugged my lcd's into a powerstrip on the desktop. and then jut hit that button. :)
May need to disable gnome-power-manager's backlight handling
On October 20th, 2009 Anonymous (not verified) says:
Because the current gnome-power-manager's backlight control is completely broken, you may need to disable it by setting /apps/gnome-power-manager/backlight/enable to false in gconf-editor. At least on my laptop gpm kept turning the backlight back on after a minute or so after running
xset dpms force off.You just need to set
On November 16th, 2009 ngine13 (not verified) says:
You just need to set /apps/gnome-power-manager/backlight/idle_brightness to 0. I tested it and works so far. :)
No i'm wrong.. :(
On November 16th, 2009 ngine13 (not verified) says:
No i'm wrong.. :(
it works with xscreensaver too
On October 20th, 2009 Anonymous (not verified) says:
the same tip can also be done if you use xscreensaver instead of gnome's
even doing
$xscreensaver-command -lock; sleep 1; xset dpms force offin a terminal worksI also was looking for a way to turn off my laptop's screen so thanks for the tip :)
You can assign the shortcut
On November 16th, 2009 ngine13 (not verified) says:
You can assign the shortcut key using "Commands" in CompizConfig Settings Manager (in Gnome).
Post new comment