#!/usr/bin/perl open (IN, "xscreensaver-command -watch |"); while () { if (m/^LOCK/) { system "$ENV{HOME}/.bin/on_lock" } elsif (m/^UNBLANK/) { #system "on_unlock" } }