-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathxstrobo
executable file
·40 lines (32 loc) · 1.01 KB
/
xstrobo
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/usr/bin/perl
# xstrobo - Adaption of the famous Augenkrebs Flash movies on the Internet
# using xgamma
# Copyright (c) 2008 Lara Stoltenow <penma@penma.de>
# Licensed under WTFPL
# No warranty for eye damage!
use strict;
use Time::HiRes;
print STDERR "xstrobo 0.2\n";
print STDERR "No warranty for eye damage!\n";
# Save original gamma
$_ = qx(xgamma 2>&1);
/-> Red ?([^, ]+), Green ?([^, ]+), Blue ?([^, ]+)/;
my ($ORGamma, $OGGamma, $OBGamma) = ($1, $2, $3);
$SIG{"TERM"} = $SIG{"INT"} = sub { system("xgamma -q -rgamma $ORGamma -ggamma $OGGamma -bgamma $OBGamma"); exit(1); };
my (@RGamma, @GGamma, @BGamma, @Sleep);
while (scalar(@ARGV) > 0)
{
push(@RGamma, shift(@ARGV));
push(@GGamma, shift(@ARGV));
push(@BGamma, shift(@ARGV));
push(@Sleep, shift(@ARGV));
}
print STDERR "SIGINT (Ctrl-C) or SIGTERM to cancel, will restore old values\n";
while (1)
{
for (0..(scalar(@RGamma) - 1))
{
system("xgamma -q -rgamma $RGamma[$_] -ggamma $GGamma[$_] -bgamma $BGamma[$_]");
Time::HiRes::usleep($Sleep[$_]);
}
}