aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorFlorian Fischer <florian.fischer@muhq.space>2024-09-26 11:42:29 +0200
committerFlorian Fischer <florian.fischer@muhq.space>2024-09-26 11:42:29 +0200
commit577ee888ecf78e262d8dc36a1be574577ad1fe72 (patch)
tree130b7aa4e02795bf8a5773a3408780470305484a /scripts
parentc3ddcf906dd2e5f0c153fc8b2f2e29e5c70e5371 (diff)
downloadunterricht-577ee888ecf78e262d8dc36a1be574577ad1fe72.tar.gz
unterricht-577ee888ecf78e262d8dc36a1be574577ad1fe72.zip
add simple think-pair-share timer script
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/idw-timer32
1 files changed, 32 insertions, 0 deletions
diff --git a/scripts/idw-timer b/scripts/idw-timer
new file mode 100755
index 00000000..ee3b68de
--- /dev/null
+++ b/scripts/idw-timer
@@ -0,0 +1,32 @@
+#!/usr/bin/bash
+# Present exercises next to a simple timer.
+SOUND="/usr/share/sounds/freedesktop/stereo/alarm-clock-elapsed.oga"
+THINK=30
+PAIR=30
+PATTERN="*.pdf"
+PEACLOCK_CONF="$(mktemp /tmp/peaclock-XXX.conf)"
+PEACLOCK_ARGS="-u $PEACLOCK_CONF"
+
+# Create a temporary peaclock timer config
+write_timer_conf() {
+ echo "set seconds on" > $PEACLOCK_CONF
+ echo "timer ${1}s" >> $PEACLOCK_CONF
+ echo "mode timer" >> $PEACLOCK_CONF
+ echo "timer start" >> $PEACLOCK_CONF
+}
+
+for f in "$1"/$PATTERN; do
+ zathura "$f" &
+
+ write_timer_conf $THINK
+ timeout --foreground $THINK peaclock $PEACLOCK_ARGS
+ ffplay -autoexit -nodisp "$SOUND" 2>/dev/null
+
+ write_timer_conf $PAIR
+ timeout --foreground $PAIR peaclock $PEACLOCK_ARGS
+ ffplay -autoexit -nodisp "$SOUND" 2>/dev/null
+
+ reset
+ read -p "next>"
+ kill $(jobs -p)
+done