-
Notifications
You must be signed in to change notification settings - Fork 0
/
average_sky_color.sh
executable file
·51 lines (45 loc) · 1.18 KB
/
average_sky_color.sh
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
#!/bin/bash
cp /tmp/sky_stripes{,_old}.png
wget http://12.52.91.101/axis-cgi/jpg/image.cgi \
-O /tmp/sky.jpg \
-o /tmp/sky.log
mogrify -crop 280x200+0+0 /tmp/sky.jpg
read red blue green <<< $(convert /tmp/sky.jpg \
-modulate 100,200,100 \
-scale 1x1\! \
-format '%[fx:int(255*r+.5)] %[fx:int(255*g+.5)] %[fx:int(255*b+.5)]' \
info:- )
convert $(dirname $0)/StripesBW.png \
-fill "rgb($red,$blue,$green)" \
-colorize 70% \
/tmp/sky_stripes.png
sync
cat>/tmp/background.xml<<EOF
<background>
<starttime>
<hour>$(date +%H)</hour>
<minute>$(date +%M)</minute>
<second>$(date +%S)</second>
</starttime>
<static>
<duration>10.0</duration>
<file>/tmp/sky_stripes_old.png</file>
</static>
<transition type="overlay">
<duration>590.0</duration>
<from>/tmp/sky_stripes_old.png</from>
<to>/tmp/sky_stripes.png</to>
</transition>
<static>
<duration>3600.0</duration>
<file>/tmp/sky_stripes.png</file>
</static>
<transition type="overlay">
<duration>600.0</duration>
<from>/tmp/sky_stripes.png</from>
<to>/tmp/sky_stripes.png</to>
</transition>
</background>
EOF
# Run this in cron, activate the background using:
gsettings set org.gnome.desktop.background picture-uri file:///tmp/background.xml