dotfiles/scripts/watch_xscreensaver.pl

19 lines
321 B
Perl
Executable File

#!/usr/bin/perl
my $blanked = 0;
open (my $in, "xscreensaver-command -watch |") || die;
while (<$in>) {
if (m/^(BLANK|LOCK)/) {
if (!$blanked) {
system ("/home/andrzej/scripts/switch-bg.sh");
$blanked = 1;
}
} elsif (m/^UNBLANK/) {
# system ("sound-on");
$blanked = 0;
}
sleep 3;
}