Created
November 2, 2015 12:15
-
-
Save bafu/5660ec280a8c9dd73125 to your computer and use it in GitHub Desktop.
Command line Pomodoro
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/sh | |
# http://superuser.com/questions/224265/pomodoro-timer-for-linux | |
VERSION="1.0" | |
LOGFILE="$HOME/.cache/pomodoro.log" | |
DURATION_TASK="1500" # 25-min | |
DURATION_SHORT_BREAK="300" # 5-min | |
DURATION_LONG_BREAK="900" # 15-min | |
#DURATION_TASK="5" # 25-min | |
#DURATION_SHORT_BREAK="3" # 5-min | |
#DURATION_LONG_BREAK="9" # 15-min | |
log() { | |
echo "$(date --rfc-3339=seconds), $1" >> $LOGFILE | |
} | |
task() { | |
shift 1 | |
taskname=$@ | |
notify-send "task, starts: $taskname" | |
log "task, starts: $taskname" | |
sleep $DURATION_TASK | |
notify-send "task, expires: $taskname" | |
log "task, expires: $taskname" | |
} | |
short_break() { | |
notify-send "short break, starts" | |
log "short break, starts" | |
sleep $DURATION_SHORT_BREAK | |
notify-send "short break, finished" | |
log "short break, finished" | |
} | |
long_break() { | |
notify-send "long break, starts" | |
log "long break, starts" | |
sleep $DURATION_LONG_BREAK | |
notify-send "long break, finished" | |
log "long break, finished" | |
} | |
main() { | |
if [ "$1" = "task" ]; then | |
task $@ | |
elif [ "$1" = "short" ]; then | |
short_break | |
elif [ "$1" = "long" ]; then | |
long_break | |
else | |
echo "USAGE: pomodoro-cli [task <desc> | short | long]" | |
echo "" | |
echo "log file" | |
echo " \$HOME/.cache/pomodoro.log" | |
echo "" | |
echo "Default durations" | |
echo " task: 25 mins" | |
echo " short break: 5 mins" | |
echo " long break: 15 mins" | |
fi | |
} | |
main $@ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment