Skip to content

Commit 394bba0

Browse files
committed
Add pomodoro.sh - a simple pomodoro app written in bash
1 parent bc83895 commit 394bba0

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

pomodoro.sh

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/bin/bash
2+
3+
# A simple shell script to use as a pomodoro app.
4+
# The first argument is the focus time length.
5+
# The second argument is the break length.
6+
# Made by Kiailandi (https://github.com/kiailandi)
7+
8+
wseconds=${1:-25}*60;
9+
pseconds=${2:-wseconds/300}*60;
10+
11+
while true; do
12+
date1=$((`date +%s` + $wseconds));
13+
while [ "$date1" -ge `date +%s` ]; do
14+
echo -ne "$(date -u --date @$(($date1 - `date +%s` )) +%H:%M:%S)\r";
15+
done
16+
notify-send "Break" "Time to walk and rest";
17+
read -n1 -rsp $'Press any key to continue or Ctrl+C to exit...\n';
18+
date2=$((`date +%s` + $pseconds));
19+
while [ "$date2" -ge `date +%s` ]; do
20+
echo -ne "$(date -u --date @$(($date2 - `date +%s` )) +%H:%M:%S)\r";
21+
done
22+
notify-send "Work" "Time to get back to work";
23+
read -n1 -rsp $'Press any key to continue or Ctrl+C to exit...\n';
24+
done

0 commit comments

Comments
 (0)