LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Scripting a work around to turn off monitor with xscreensaver (https://www.linuxquestions.org/questions/linux-newbie-8/scripting-a-work-around-to-turn-off-monitor-with-xscreensaver-770318/)

dasbooter 11-19-2009 05:35 PM

Scripting a work around to turn off monitor with xscreensaver
 
I am trying to use the electricsheep screensaver but for some reason it seems to be the only one that wont let the monitor go into an off state (other hacks work). I have posted on the maintainer of electricsheeps web site but I would like to get some help to script a work-around. Xscreensaver provides for interaction with scripts with xscreensaver-command watch so a script can be run on start and stop of the screensaver. I would like to have xscreensaver start a script that lets the screensaver run (BLANKS) for awhile then does an xset dpms force off. If somebody interrupts the screensaver (the screen UNBLANKS) I would like the script that was started to stop so the screen doesnt get forced off. So far all my attempts have been feeble I think because of the way the process the script calls are spawned but I am not sure. Here is the code for the xscreensaver monitor script. You put the 2 scripts in the same directory that you want run with the BLANKING and UNBLANKING of the screen.

Code:

#!/usr/bin/perl

my $blanked = 0; open (IN, "xscreensaver-command -watch |"); while (<IN>) { if (m/^(BLANK|LOCK)/) { if (!$blanked) { system "startcountdown"; $blanked = 1; } } elsif (m/^UNBLANK/) { system "killer"; $blanked = 0; } }

In this instance my 2 scripts are called startcountdown and killer


All times are GMT -5. The time now is 06:20 PM.