Are there any utilities that will disable my LAN connection when the screensaver kicks in?

link|improve this question
4  
In what operating system? – Flimzy Jul 1 '11 at 6:44
2  
Yeah, what OS? That would help a TON. – surfasb Jul 1 '11 at 8:06
feedback

1 Answer

For what operating system?

In linux you should be able to do something similar to

#!/usr/bin/perl
#gnome
my $cmd = "dbus-monitor --session \"type='signal',interface='org.gnome.ScreenSaver',member='SessionIdleChanged'\"";

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

my $interface = <DEFINE INTERFACE HERE>

open (IN, "$cmd |");

while (<IN>) {
if (m/^\s+boolean true/) {
    #when screensaver activates, run the following commands
    system("/sbin/ifdown $interface");
} elsif (m/^\s+boolean false/) {
    #when screensaver deactivates, run the following commands
    system("/sbin/ifup $interface");
}
}

save it as something memorable to /etc/rc.d

make it executable with chmod +x

Original Script

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.