#!/usr/bin/env perl

my $cmd = "dbus-monitor --session \"type='signal',interface='org.gnome.ScreenSaver',member='SessionIdleChanged'\"";

open (IN, "$cmd |");

while (<IN>) {
    if (m/^\s+boolean true/) {
        `./hello-world`;
    } elsif (m/^\s+boolean false/) {
        print "*** Session is no longer idle ***\n";
    }
}
