blob: 21ec61a23eef02eed09e0f43e1d5bda4b4d01bdf (
plain)
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
|
#!/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"
echo "timer ${1}s"
echo "mode timer"
echo "timer start"
} > "$PEACLOCK_CONF"
}
for f in "$1"/$PATTERN; do
xdg-open "$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
|