-
Notifications
You must be signed in to change notification settings - Fork 109
/
pomodoro
executable file
·40 lines (30 loc) · 1.05 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
#!/bin/bash
function pomodoro(){
LEN=$1
WARN=$2
let length=${LEN:-10*60}; # allows for arithmetic like `pomodoro 25*60` == `pomodoro 1500`
let warn_period=${WARN:-120}
if (($warn_period > $length)); then
warn_period=0;
fi
let length_before_warn=length-warn_period; # allows for arithmetic like `pomodoro 25*60` == `pomodoro 1500`
say Starting pomodoro
green "Starting pomodoro of $length seconds, warning $warn_period seconds before end\n"
# main work
luxafor-cli --color magenta;
sleep $length_before_warn;
# warn about time running out
pink "Only $warn_period seconds left \n"
luxafor-cli --blink 255,255,0;
sleep 2; # need to not cut off the blinking too early - it doesn't block
luxafor-cli --color red;
sleep $warn_period;
# time out
dark_yellow "Time out!\n"
luxafor-cli --blink 0,255,0;
sleep 2; # need to not cut off the blinking too early - it doesn't block
bugme;
dark_grey "\nPomodoro finished\n";
say "Pomodoro finished";
}
pomodoro $@