Created
December 11, 2011 18:48
-
-
Save gazs/1462063 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
| clear | |
| function notify() { | |
| notify-send -u critical -i appointment "Pomodoro" "$1" | |
| } | |
| function measure() { | |
| case "$1" in | |
| pomodoro) newpomodoro; mark="#"; length=25 ;; | |
| break) mark="."; length=5 ;; | |
| longbreak) mark="."; length=15 ;; esac | |
| notify "$length minutes $1 $pomodoroname" | |
| tput sc | |
| tput el | |
| tput cuf $length | |
| enddate=$(date +%H:%M -d +"$length minutes") | |
| echo "| $enddate" | |
| tput rc | |
| for a in $(seq 1 $length); do | |
| echo -n "$mark" 1>&2 | |
| sleep 60 | |
| done | |
| } | |
| function newpomodoro() { | |
| echo "" | |
| tput sc | |
| read -p "next pomodoro: " pomodoroname | |
| tput el1 | |
| tput rc | |
| echo -n "$i. $pomodoroname $(date +%H:%M) " | |
| } | |
| i=1 | |
| while true; do | |
| echo -e "\n$(date)" | |
| for a in $(seq 1 3); do | |
| # pomodoro for 25 minutes | |
| measure "pomodoro" | |
| # break for 5 minutes | |
| measure "break" | |
| let "i+=1" | |
| done | |
| # every 4 pomodoro: longer break | |
| measure "pomodoro" | |
| measure "longbreak" | |
| let "i+=1" | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment