Advertisement
Hypfer

Untitled

Jan 9th, 2017
574
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 0.37 KB | None | 0 0
  1. #!/usr/bin/perl
  2. use Time::HiRes qw(usleep nanosleep);
  3.  
  4. my $blanked = 0;
  5. open (IN, "xscreensaver-command -watch |");
  6. while (<IN>) {
  7.     if (m/^(BLANK|LOCK)/) {
  8.         if (!$blanked) {
  9.             system "wmctrl -s 1";
  10.             $blanked = 1;
  11.         }
  12.     } elsif (m/^UNBLANK/) {
  13.         usleep(100000);
  14.         system "wmctrl -s 0";
  15.         $blanked = 0;
  16.     }
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement