diff --git a/README.md b/README.md index e0b6928..32b1f83 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,11 @@ # Simple_Bash_Pomodoro -A simple Pomodoro timer. \ No newline at end of file +A simple Pomodoro timer. + +## Usage + + ./simple_bash_pomodoro.sh working_minutes break_minutes + +i.e.: + + ./simple_bash_pomodoro.sh 25 5 \ No newline at end of file diff --git a/simple_bash_pomodoro.sh b/simple_bash_pomodoro.sh new file mode 100755 index 0000000..5c172ca --- /dev/null +++ b/simple_bash_pomodoro.sh @@ -0,0 +1,41 @@ +#!/bin/bash + +if [ $# -ne 2 ] +then + echo "Usage : $0 working_minutes break_minutes" + exit -1 +fi + +if [ $1 -lt 1 ] +then + echo "working_minutes should be > 1" + exit -1 +fi + +if [ $2 -lt 1 ] +then + echo "break_minutes should be > 1" + exit -1 +fi + +# Until we quit using ^C +while [ 1 ] +do + notify-send --app-name "Pomodoro" "Let's go! $2 minute(s) break in $1 minute(s)." + paplay "/usr/share/sounds/freedesktop/stereo/complete.oga" + + # For every minute of work + work_minutes=$1 + for work_minute in $(seq 0 $work_minutes) + do + echo $(echo "$work_minutes - $work_minute" | bc) "minute(s) restante(s)..." + sleep 60 + done + notify-send --app-name "Pomodoro" "It's time to take a break" + paplay "/usr/share/sounds/freedesktop/stereo/alarm-clock-elapsed.oga" + + # Break + sleep $(echo "$2 * 60 - 60" | bc) + notify-send --app-name "Pomodoro" "Back to work in one minute!" + sleep 60 +done