summaryrefslogtreecommitdiff
path: root/share/hackvr/examples/clock/run.pre
blob: aa426b6f9d786b64cbd21e24bf57c1d8eaa8e339 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/usr/bin/env bash
if [ "$1" = "init" ];then
  grep -A1000 '___CUT___' "$0"
  exit
elif [ "$1" = "set" ];then
  hour=$(date +%H | sed 's/^0//')
  minute=$(date +%M | sed 's/^0//')
  second=$(date +%S | sed 's/^0//')
  printf "_clock_face_hand_hour_ rotate 0 0 -%s\n" "$[$hour * 30 + ($minute / 2)]"
  printf "_clock_face_hand_minute_ rotate 0 0 -%s\n" "$[$minute * 6]"
  printf "_clock_face_hand_second_ rotate 0 0 -%s\n" "$[$second * 6]"
  #printf "_clock_face_hand_hour_ rotate 0 0 %s\n" "$[$hour * 30 + ($minute / 2)]"
  #printf "_clock_face_hand_minute_ rotate 0 0 %s\n" "$[$minute * 6]"
  #printf "_clock_face_hand_second_ rotate 0 0 %s\n" "$[$second * 6]"
else
  nonblocktail \
      <(echo $USER move 0 0 -30) \
      <("$0" init) \
      <(while true;do "$0" set;sleep 1;done) \
      /dev/stdin 2>/dev/null \
    | hackvr 2>/dev/null
fi
exit 0
___CUT___