Skip to content

Instantly share code, notes, and snippets.

@hamsolodev
Created August 28, 2011 03:02
Show Gist options
  • Save hamsolodev/1176186 to your computer and use it in GitHub Desktop.
Save hamsolodev/1176186 to your computer and use it in GitHub Desktop.
zsh function to control OSX Pomodoro app from shell
# use AppleScript to communicate with the Pomodoro application
function pom {
case $1 in
start)
# if it weren't for the use of arg ranges here then this function would work in straight sh
TASK=$*[2,-1]
DURATION=25
BREAK=5
osascript -e "tell app \"Pomodoro\" to start \"${TASK}\" duration ${DURATION} break ${BREAK}"
;;
stop)
osascript -e "tell app \"Pomodoro\" to reset"
;;
pause)
osascript -e "tell app \"Pomodoro\" to external interrupt"
;;
resume)
osascript -e "tell app \"Pomodoro\" to resume"
;;
*)
echo "${0} {start task desc…|stop|pause|resume}"
esac
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment