chipperuga
April 7th, 2010, 02:28 PM
For a kiosk scenario, I run this script to close & restart Firefox when the screensaver is activated (the monitor also goes to sleep).
I want to run a loop that, if Firefox is closed, it will automatically re-open. Is there a way to use dbus-monitor to accomplish this?
#!/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/)
{
system("pkill -9 firefox");
system("/usr/bin/firefox &");
system("xset dpms force off");
}
elsif (m/^\s+boolean false/)
{
#when not idle
#system("/usr/bin/firefox &");
}
}
I want to run a loop that, if Firefox is closed, it will automatically re-open. Is there a way to use dbus-monitor to accomplish this?
#!/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/)
{
system("pkill -9 firefox");
system("/usr/bin/firefox &");
system("xset dpms force off");
}
elsif (m/^\s+boolean false/)
{
#when not idle
#system("/usr/bin/firefox &");
}
}