Skip to content

Commit cafea09

Browse files
Pomodoro Scheduler
1 parent f0d796c commit cafea09

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

Pomodoro.sh

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#!/bin/bash
2+
wseconds=${1:-25}*60;
3+
pseconds=${2:-wseconds/300}*60;
4+
if [ "$(uname)" == "CodeMaster7000" ]; then
5+
while true; do
6+
date1=$((`date +%s` + $wseconds));
7+
while [ "$date1" -ge `date +%s` ]; do
8+
echo -ne "$(date -u -j -f %s $(($date1 - `date +%s`)) +%H:%M:%S)\r";
9+
done
10+
osascript -e 'display notification "Break"';
11+
read -n1 -rsp $'Press any key to continue (Ctrl+C to exit)\n';
12+
date2=$((`date +%s` + $pseconds));
13+
while [ "$date2" -gt `date +%s` ]; do
14+
echo -ne "$(date -u -j -f %s $(($date2 - `date +%s`)) +%H:%M:%S)\r";
15+
done
16+
osascript -e 'display notification "Work"';
17+
read -n1 -rsp $'Press any key to continue (Ctrl+C to exit)\n';
18+
done
19+
elif [ "$(expr substr $(uname -s) 1 5)" == "Linux" ]; then
20+
while true; do
21+
date1=$((`date +%s` + $wseconds));
22+
while [ "$date1" -ge `date +%s` ]; do
23+
echo -ne "$(date -u --date @$(($date1 - `date +%s` )) +%H:%M:%S)\r";
24+
done
25+
notify-send "Break";
26+
read -n1 -rsp $'Press any key to continue (Ctrl+C to exit)\n';
27+
date2=$((`date +%s` + $pseconds));
28+
while [ "$date2" -ge `date +%s` ]; do
29+
echo -ne "$(date -u --date @$(($date2 - `date +%s` )) +%H:%M:%S)\r";
30+
done
31+
notify-send "Work";
32+
read -n1 -rsp $'Press any key to continue (Ctrl+C to exit)\n';
33+
done
34+
else
35+
echo -ne "Your OS is not supported.\n";
36+
fi

0 commit comments

Comments
 (0)