Created
August 28, 2011 03:02
-
-
Save hamsolodev/1176186 to your computer and use it in GitHub Desktop.
zsh function to control OSX Pomodoro app from shell
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
# 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