summaryrefslogtreecommitdiff
path: root/share/hackvr/examples/clock/run.pre
diff options
context:
space:
mode:
authorepoch <epoch@enzo.thebackupbox.net>2020-12-19 03:49:28 -0600
committerepoch <epoch@enzo.thebackupbox.net>2020-12-19 03:49:28 -0600
commitbc856202d45e117d4f5f5006be2d2387e6799e6a (patch)
tree3c406ee008d24d8d24af29ef847c111599bb6e6c /share/hackvr/examples/clock/run.pre
parent6241f5a8627632242b7cf613bdc0a296ed85b35e (diff)
downloadhackvr-bc856202d45e117d4f5f5006be2d2387e6799e6a.tar.gz
hackvr-bc856202d45e117d4f5f5006be2d2387e6799e6a.zip
changed how the clock example works so it can work stand-alone and be make install'd and used easier by other scripts
Diffstat (limited to 'share/hackvr/examples/clock/run.pre')
-rwxr-xr-xshare/hackvr/examples/clock/run.pre24
1 files changed, 24 insertions, 0 deletions
diff --git a/share/hackvr/examples/clock/run.pre b/share/hackvr/examples/clock/run.pre
new file mode 100755
index 0000000..aa426b6
--- /dev/null
+++ b/share/hackvr/examples/clock/run.pre
@@ -0,0 +1,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___