-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathfocus.sh
executable file
·55 lines (44 loc) · 1.01 KB
/
focus.sh
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
47
48
49
50
51
52
53
54
55
#!/bin/sh
# Helps you keep track of time.
# Depends on libnotify
# TODO play a sound when time changes
# TODO argument to send signal that will close program
# Just incase you send it to bg
#trap "notify-send $APP "Timer ended"; exit 0;" SIGINT
# TODO some sort of constant notification of what mode you're in?
# Save to $TIMER ?
APP="Focus"
usage() {
echo "Options"
echo " -h Show this message"
echo " -f [time] Fun time"
echo " -d [time] Distract time"
exit 0
}
main() {
DISTRACT=15
FOCUS=45
while getopts ":f:d:h" OPTION
do
case $OPTION in
h) usage ;;
f) FOCUS=$OPTARG ;;
d) DISTRACT=$OPTARG ;;
?) echo "Invalid argument."; usage ;;
esac
done
FOCUS=$(($FOCUS*60))
DISTRACT=$(($DISTRACT*60))
# let "FOCUS *= 60"
# let "DISTRACT *= 60"
while true; do
notify-send $APP "It's time to focus for $(($FOCUS / 60)) minutes!"
echo "Focus"
sleep $FOCUS
notify-send $APP "You can be distracted for $(($DISTRACT / 60)) minutes."
echo "Distraction"
sleep $DISTRACT
done
exit 0
}
main $*