2

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)?

Thanks.

1
  • 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
    Commented Oct 14, 2010 at 13:34

2 Answers 2

1
#!/usr/bin/env perl
system 'sleep 1';
system 'xset dpms force off';
system 'gnome-screensaver-command -i &';
while(<>){`killall gnome-screensaver-command`;exit}
1

You could use vbetool (which requires lrmi)

vbetool dpms off

You could plug it into this following perl script (copied from gnomescreensaver.org 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";

  }
}

You must log in to answer this question.

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