From 501dd5505d950d89f5b4d0ad8249c38c36a102da Mon Sep 17 00:00:00 2001 From: lonkaars Date: Tue, 12 Mar 2024 10:19:24 +0100 Subject: replace hard-coded breaks with plugin --- core/lap | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100755 core/lap (limited to 'core/lap') diff --git a/core/lap b/core/lap new file mode 100755 index 0000000..3c51c0c --- /dev/null +++ b/core/lap @@ -0,0 +1,17 @@ +#!/bin/sh +[ "$1" = "info" ] && echo "calculate lap duration" && exit 2 + +lap="$1" +break_rule() { + break_interval=$1 + break_duration=$2 + if [ $(( $lap % $break_interval )) -eq $(( $break_interval - 1 )) ] ; then + echo $break_duration + exit 0 + fi +} + +break_rule 6 $(( 15 * 60 )) # every 6th lap (every 3rd break) is a 15 minute break +break_rule 2 $(( 5 * 60 )) # every 2nd lap is a 5 minute break +echo $(( 25 * 60 )) # every other lap is a normal 25 minute lap + -- cgit v1.2.3