Skip to content

Instantly share code, notes, and snippets.

@alja
Created October 17, 2014 15:55
Show Gist options
  • Save alja/e35aaa241e5d824fced8 to your computer and use it in GitHub Desktop.
Save alja/e35aaa241e5d824fced8 to your computer and use it in GitHub Desktop.
disable screen going to sleep
#!/usr/bin/env perl
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) =
localtime(time);
$stt = localtime;
print "ssCheck $stt HOUR = $hour \n";
$ENV{DISPLAY}=':0.0';
$ENV{PATH}="/usr/local/bin:/bin:/usr/bin:/usr/sbin";
$ENV{LD_LIBRARY_PATH}="/usr/sbin:/usr/local/lib";
for $k (sort keys %ENV) { print $k, "\n"; }
if ($hour >= 19)
{
system("xset dpms force off");
printf("disable \n");
}
elsif ($hour >= 7)
{
system("xset -dpms");
system("xdotool mousemove_relative 0 1");
sleep 1;
system("xdotool mousemove_relative 0 -1");
printf("wake up \n");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment