Created
June 3, 2012 21:47
-
-
Save infertux/2865140 to your computer and use it in GitHub Desktop.
Cheap pomodoro timer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Cheap pomodoro timer | |
# https://en.wikipedia.org/wiki/Pomodoro_Technique | |
set -eu | |
trap bye INT TERM | |
bye() { | |
echo -e "\nThe tomato has been squashed." | |
} | |
say() { | |
command -v espeak >/dev/null && espeak -a 200 "$@" | |
} | |
output() { | |
echo "[$(date +%R)] $@" | |
} | |
echo "Hey you! I'm a tomato, listen to me!" | |
i=0 | |
while true; do | |
echo | |
output "Decide on the task to be done then work on the task until the timer rings (25 minutes)." | |
say "Work" | |
i=$((i + 1)) | |
sleep 1500 | |
if [ $((i % 4)) -eq 0 ]; then | |
output "Take a long break (20 minutes)." | |
say "Long break" | |
sleep 1200 | |
else | |
output "Take a short break (5 minutes)." | |
say "Short break" | |
sleep 300 | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment