Pomodoro script

This commit is contained in:
Quentin Bouteiller 2019-08-19 22:24:41 +02:00
parent 614f206fe5
commit 1db4cb70a0
2 changed files with 50 additions and 1 deletions

View File

@ -1,3 +1,11 @@
# Simple_Bash_Pomodoro # Simple_Bash_Pomodoro
A simple Pomodoro timer. A simple Pomodoro timer.
## Usage
./simple_bash_pomodoro.sh working_minutes break_minutes
i.e.:
./simple_bash_pomodoro.sh 25 5

41
simple_bash_pomodoro.sh Executable file
View File

@ -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