Update manual page
[pipeglade.git] / clock.sh
blob784cdc3bd2dabfb72912da19395d49aa12a283bb
1 #!/usr/bin/env bash
4 H0=0
5 M0=0
6 S0=0
7 C=220
8 TX=155
9 TY=250
10 HL=100
11 ML=195
12 SL=195
13 R=215
15 echo "drawingarea1:set_line_cap 10000 round"
16 echo "drawingarea1:set_font_size 10000 20"
17 echo "drawingarea1:arc 10000 $C $C $R 0 360"
18 echo "drawingarea1:set_source_rgba 10000 black"
19 echo "drawingarea1:fill 10000"
20 while true; do
21 D=`date +%F`
22 H=$(((`date +"%s"`/1200%72*10)+270+720))
23 M=$(((`date +"%s"`/20%180*2)+270+360))
24 S=$((((`date +"%s"`%60)*6)+270))
25 # date and hour hand
26 if [[ H -ne H0 ]]; then
27 echo "drawingarea1:move_to $H $TX $TY"
28 echo "drawingarea1:set_source_rgba $H white"
29 echo "drawingarea1:show_text $H $D"
30 echo "drawingarea1:move_to $H $C $C"
31 echo "drawingarea1:arc $H $C $C $HL $H $H"
32 echo "drawingarea1:set_source_rgba $H rgba(255,255,0,.8)"
33 echo "drawingarea1:set_dash $H"
34 echo "drawingarea1:set_line_width $H 30"
35 echo "drawingarea1:stroke $H"
36 echo "drawingarea1:remove $H0"
37 H0=$H
39 # minute hand
40 if [[ M -ne M0 ]]; then
41 echo "drawingarea1:move_to $M $C $C"
42 echo "drawingarea1:arc $M $C $C $ML $M $M"
43 echo "drawingarea1:set_source_rgba $M rgba(0,255,0,.7)"
44 echo "drawingarea1:set_dash $M"
45 echo "drawingarea1:set_line_width $M 25"
46 echo "drawingarea1:stroke $M"
47 echo "drawingarea1:remove $M0"
48 M0=$M
50 # second hand
51 echo "drawingarea1:move_to $S $C $C"
52 echo "drawingarea1:arc $S $C $C $SL $S $S"
53 echo "drawingarea1:set_source_rgba $S cyan"
54 echo "drawingarea1:set_line_width $S 2"
55 echo "drawingarea1:set_dash $S 4 4"
56 echo "drawingarea1:stroke $S"
57 echo "drawingarea1:remove $S0"
58 S0=$S
59 echo "drawingarea1:refresh"
61 sleep 1
62 done
63 ) | ./pipeglade -u clock.ui