Screensaver on, CPU goes quiet.
https://people-mozilla.org/~jmuizelaar/fishbowl/fishbowl-gl.html
Now I am with the CPU.
So I created an script that reacts to screensaver changes and basically stops/starts all the browsers (the hungry CPU eaters on my PC). As simple as that.
Most of the script comes from within the manual xscreensaver-command
# man xscreensaver-command
# man xscreensaver-command
Here is the full script (I used "# tail -f" on a text file during testing to verify it was working, plus looking at the CPU graph).
---------------
#!/usr/bin/perl
my $blanked = 0;
open (IN, "xscreensaver-command -watch |");
while (<IN>) {
if (m/^(BLANK|LOCK)/) {
if (!$blanked) {
# que hacer
#system "sound-off";
system "killall -s STOP iceweasel chromium firefox";
#system "echo 'stopped all' >> /home/xx/tmp/sss";
#system "date >> /home/xx/tmp/sss";
$blanked = 1;
}
} elsif (m/^UNBLANK/) {
# que hacer
#system "sound-on";
system "killall -s CONT iceweasel chromium firefox";
#system "echo 'started all' >> /home/xx/tmp/sss";
#system "date >> /home/xx/tmp/sss";
$blanked = 0;
}
}
---------------
---------------
#!/usr/bin/perl
my $blanked = 0;
open (IN, "xscreensaver-command -watch |");
while (<IN>) {
if (m/^(BLANK|LOCK)/) {
if (!$blanked) {
# que hacer
#system "sound-off";
system "killall -s STOP iceweasel chromium firefox";
#system "echo 'stopped all' >> /home/xx/tmp/sss";
#system "date >> /home/xx/tmp/sss";
$blanked = 1;
}
} elsif (m/^UNBLANK/) {
# que hacer
#system "sound-on";
system "killall -s CONT iceweasel chromium firefox";
#system "echo 'started all' >> /home/xx/tmp/sss";
#system "date >> /home/xx/tmp/sss";
$blanked = 0;
}
}
---------------
0 Comments:
Post a Comment
<< Home