#!/usr/bin/perl -w use strict; $ENV{'PATH'} = '/bin:/usr/bin:/usr/local/bin'; delete @ENV{'IFS', 'CDPATH', 'ENV', 'BASH_ENV'}; my $oldstate = "brightness:3"; open(XS,"/usr/bin/xscreensaver-command -watch|") or die; while() { if(/^BLANK/i) { open(OLDB, "lcd brightness:0|") or die "couldn't read old lcd and set"; $oldstate = ; close OLDB; } elsif(/^UNBLANK/i) { system("lcd $oldstate"); } }