-
Notifications
You must be signed in to change notification settings - Fork 4
/
Pomodoro
executable file
·46 lines (42 loc) · 1.6 KB
/
Pomodoro
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/bin/bash
zenitycounter() {
END=`date --utc --date "now +$1 minute" +%s`
ENDD=`date --date "now +$1 minute" +%T`
#(for i in {0..300}; do
(while :; do
DIFFSEC=$((END-`date --utc --date "now" +%s`))
PERCENTAGE=`echo "100-(100*($DIFFSEC/($1*60)))" | bc -l`
printf "%.0f\n" $PERCENTAGE
R=$(date --utc --date "1970-01-01 $DIFFSEC sec" "+%T")
echo "# $R remain";
sleep 1;
if [ "$DIFFSEC" -lt "0" ]; then break; fi
done) | zenity --progress --auto-close --title="Pomodoro $1-min [until $ENDD] $2" --width=425
}
# 25 minutes timer
play -q ./bell.ogg repeat 2 &
zenity --question --text="Start Pomodoro 25 minute Work?"
if [[ $? -eq 1 ]]; then
exit 0
fi
DISPLAY=:0 notify-send -t 5000 -i ./pomodoro64.png "New Pomodoro starts" "You have 25 minutes to work." &
zenitycounter "25" "Work"
ENDD=`date --utc --date "now" +%T`
mpg123 -q ./antique_alarm_128.mp3 &
DISPLAY=:0 notify-send -t 10000 -i ./pomodoro64.png "Pomodoro ended" "Take a break!"
# 4 minutes timer
zenity --question --text="Pomodoro finished at [$ENDD]! Start 5 minute rest?!"
if [[ $? -eq 1 ]]; then
zenity --info --text="Pomodoro finished at [$ENDD]! Confirm! Please restart Pomodoro in order to make another turn."
exit 0
fi
play -q ./arnold_hastalavistababy.wav &
zenitycounter "5" "Rest"
ENDD=`date --utc --date "now" +%T`
play -q ./bell.ogg repeat 5
play -q ./arnold_illbeback.wav &
zenity --info --text="Rest finished at [$ENDD]! Confirm! Please restart Pomodoro in order to make another turn."
#mpg123 -q ZeroSignal.mp3
#sleep 1500
#echo "Sleep 1500"
#play -q /usr/share/sounds/ubuntu/stereo/bell.ogg repeat 2