Simple_Bash_Pomodoro/simple_bash_pomodoro.sh
2019-08-19 22:24:41 +02:00

42 lines
871 B
Bash
Executable File

#!/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