Skip to content

Instantly share code, notes, and snippets.

@davepeck
Created February 12, 2010 02:18
Show Gist options
  • Save davepeck/302232 to your computer and use it in GitHub Desktop.
Save davepeck/302232 to your computer and use it in GitHub Desktop.
#!/bin/sh
## script POMODORO for OSX! ##
# #
# requires the GNU gdate command to format dates #
# it's available through macports, in the coreutils package #
# this script also requires Growl to display notifications #
# #
# Times are coded as follows: #
# @ long break : 30 minutes #
# @ short break : 5 minutes #
# @ pomodoro : 25 minutes, obviously ;) #
# #
# by Andrea Schiavini -- fixed up to work by @dangerdave #
## ##
# the break function requires an argument: "short" or "long"
function pomo_msg {
duration=300
if [ $1 = "long" ]; then
duration=1800
fi
growlnotify -s -w -m "Pomodoro is over, $1 break" -t "Pomodoro" --image pomo.tif && counter=$(($counter+1))
echo $(gdate +%Y/%m/%d\ -\ %H:%M)" - pomodoro is over, "$1" break" >> log.txt
sleep $duration && growlnotify -s -w -m "Let's go back to work!" -t "Pomodoro" --image pomo.tif
}
counter=1;
growlnotify -s -w -m "Let's start!" -t "Pomodoro" --image pomo.tif
while true; do
echo $(gdate +%Y/%m/%d\ -\ %H:%M)" - pomodoro started" >> log.txt
sleep 1500
if [ $(($counter%5)) -eq 0 ]; then
pomo_msg long
else
pomo_msg short
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment