Someone
public text v1 · immutable#!/usr/bin/perl
my $blanked = 0;
open (IN, "xscreensaver-command -watch |");
while (<IN>) {
if (m/^(BLANK|LOCK)/) {
if (!$blanked) {
system "command1";
$blanked = 1;
}
} elsif (m/^UNBLANK/) {
system "command2";
$blanked = 0;
}
}