#!/usr/bin/perl my $blanked = 0; open (IN, "xscreensaver-command -watch |"); while () { if (m/^(BLANK|LOCK)/) { if (!$blanked) { $blanked = 1; } } elsif (m/^UNBLANK/) { $blanked = 0; } }