#!/usr/bin/env zsh
# minimal PATH for i3
export PATH="$HOME/.local/bin:$HOME/.local/share/go/bin:/run/current-system/sw/bin:$PATH"
current_phase="work"
[[ "$1" == "break" ]] && current_phase="break" && shift
typeset -A pomo
pomo[work]=${1:-25}
pomo[break]=${2:-5}
pomo[long_break]=${3:-15}
count=0
trap - INT
while true; do
if [[ "$current_phase" == "work" ]]; then
((count++))
key=work
title="🍅 Session done"
text="It is now time to take a BREAK!"
speak="Break time"
else
if (( count > 0 && count % 4 == 0 )); then
echo "LONG BREAK" | lolcat
key=long_break
else
key=break
fi
title="🧘 Break over"
text="Time to get back to WORK"
speak="Work time"
fi
echo "$current_phase" | lolcat
timer ${pomo[$key]}m || break
notify-send -u normal -t 3000 -i alarm "$title" "$text"
spd-say -t male3 -r -10 -p -100 "$speak"
[[ "$current_phase" == "work" ]] && current_phase="break" || current_phase="work"
done
exit