Created
July 7, 2010 16:19
-
-
Save nibrahim/466899 to your computer and use it in GitHub Desktop.
Pomodoro timer as similar to the online focus booster as a shell script
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
function alarm() { | |
# First argument is the number of minutes spent on work (one pomodoro) | |
# Second argument is the rest time. | |
# I usually invoke this as alarm 30 5 (work for 30 minutes, rest for 5) | |
work_time=$(echo "$1*60" | bc) | |
rest_time=$(echo "$2*60" | bc) | |
( mpg123 --loop -1 ~/scratch/clock-ticking-4.mp3 > /dev/null 2>&1 & | |
mpg123pid=$! | |
(sleep ${work_time} && | |
kill $mpg123pid && | |
mpg123 -d 5 ~/scratch/alarm-clock-1.mp3 > /dev/null 2>&1 && | |
mpg123 --loop -1 ~/scratch/clock-ticking-4.mp3 > /dev/null 2>&1 & | |
mpg123pid=$! | |
(sleep ${rest_time} && | |
kill $mpg123pid && | |
mpg123 -d 5 ~/scratch/alarm-clock-1.mp3 > /dev/null 2>&1 | |
)& | |
)& | |
)& | |
disown | |
} | |
# Sound effect files obtained from http://www.soundjay.com/clock-sounds-1.html |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment