blob: 96f9d96385f09a3666d6d7e79dc433eaafa7a85c (
plain)
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
#!/bin/sh
rs() {
redshift -o -l 53.8695616:10.6875833 -t 6200:4800 "$@" >/dev/null
}
tick() {
while true; do
echo "tick"
sleep 30
done > "$REDSHIFT_FIFO"
}
daemon() {
test -e "$REDSHIFT_FIFO" && rm -f "$REDSHIFT_FIFO"
mkfifo "$REDSHIFT_FIFO"
tick &
tick_pid=$!
flag=""
cat "$REDSHIFT_FIFO" | while read cmd; do
case $cmd in
quit)
kill $tick_pid &
break
;;
toggle)
if test -n "$flag"; then
flag=""
else
flag="-x"
fi
echo "redshift $flag" > "$BAR_FIFO"
rs $flag
;;
tick)
rs $flag
;;
esac
done
}
toggle() {
echo "toggle" > "$REDSHIFT_FIFO"
}
case $1 in
daemon)
daemon
;;
toggle)
toggle
;;
esac
|