Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to get my screen to turn off whenever I lock my screen. I know that in Power Management, there's an option to turn off the screen after a set amount of time, and I know about xset dpms force off, but the former doesn't allow me to turn off the screen from the logout menu, and the latter only turns the screen off for a short amount of time (1 minute or so. The screen just turns back on by itself).

Is there a script I can modify to change what happens when "Lock screen" from the logout menu is selected, or is there a script I can add to the panel to lock the screen and then turn the monitor off (and turning it back on when I shake the mouse or something)?


share|improve this question
In Ubuntu prior to 9.10, I had a script that did gnome-screensaver-command --lock; xset dpms force off and that actually worked. But it doesn't anymore (same as you, monitor comes back on after 30 sec). – Brian Oct 14 '10 at 13:34
up vote 1 down vote accepted
#!/usr/bin/env perl
system 'sleep 1';
system 'xset dpms force off';
system 'gnome-screensaver-command -i &';
while(<>){`killall gnome-screensaver-command`;exit}
share|improve this answer

You could use vbetool (which requires lrmi)

vbetool dpms off

You could plug it into this following perl script (copied from and slighly modified for the event)

my $cmd = "dbus-monitor --session \"type='signal',interface='org.gnome.ScreenSaver',member='ActiveChanged'\"";

open (IN, "$cmd |");

while (<IN>) {
  if (m/^\s+boolean true/) {

       print "*** Session is idle ***\n";

  } elsif (m/^\s+boolean false/) {

       print "*** Session is no longer idle ***\n";

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .