Last active
August 29, 2015 14:13
-
-
Save wwwbruno/3c70bfdeb489606fa2ec to your computer and use it in GitHub Desktop.
Pomodoro Shell script
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/sh | |
| # | |
| # Pomodoro script. | |
| # | |
| # Displays an alert after 25 minutes job / 5 minutes pause. | |
| # | |
| # Shell script for a simple Pomodoro technic | |
| # | |
| # Author: Bruno Almeida <bruno@disvolvi.com> | |
| countdown() | |
| ( | |
| IFS=: | |
| set -- $* | |
| secs=$(( ${1#0} * 3600 + ${2#0} * 60 + ${3#0} )) | |
| while [ $secs -gt 0 ] | |
| do | |
| sleep 1 & | |
| printf "\r%02d:%02d:%02d" $((secs/3600)) $(( (secs/60)%60)) $((secs%60)) | |
| secs=$(( $secs - 1 )) | |
| wait | |
| done | |
| echo | |
| ) | |
| while true; do | |
| zenity --warning --title="Let's begin!" --text="For 25 minutes, get focused!" --width="400" --height="100" && | |
| countdown "00:25:00" && | |
| zenity --warning --title="Relex!" --text="For 5 minutes, take a break!" --width="400" --height="100" && | |
| countdown "00:5:00" | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment