Created
March 2, 2014 09:30
-
-
Save dictcp/9304059 to your computer and use it in GitHub Desktop.
send SIGSTOP to firefox when the workstation is locked, in order to save the CPU power
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
my $cmd = "dbus-monitor --session \"type='signal',interface='org.gnome.ScreenSaver',member='ActiveChanged'\""; | |
open (IN, "$cmd |"); | |
while (<IN>) { | |
if (m/^\s+boolean true/) { | |
print "*** Screensaver is active ***\n"; | |
system("killall -s SIGSTOP firefox plugin-container"); | |
} elsif (m/^\s+boolean false/) { | |
print "*** Screensaver is no longer active ***\n"; | |
system("killall -s SIGCONT firefox plugin-container"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment