Skip to content

Commit 4535e14

Browse files
author
cofincup
committed
update cofincup-pomo
1 parent 668b975 commit 4535e14

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

pomo/cofincup-pomo.sh

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/bin/bash
2+
3+
# get user input in minutes
4+
read -p "Enter countdown time in minutes: " countdown_minutes
5+
6+
# confirm countdown time with user
7+
read -p "Start a countdown of $countdown_minutes minutes? [Y/n]" confirm
8+
confirm=${confirm:-Y} # set default value to Y if user presses enter without entering a value
9+
10+
# exit script if user doesn't confirm countdown
11+
if [[ ! "$confirm" =~ ^[Yy]$ ]]; then
12+
echo "Countdown canceled."
13+
exit 0
14+
fi
15+
16+
# convert minutes to seconds
17+
countdown_time=$((countdown_minutes * 60))
18+
19+
# ignore hangup signal and continue running in the background
20+
nohup bash -c "sleep $countdown_time && paplay /usr/share/sounds/freedesktop/stereo/complete.oga && notify-send 'Countdown complete!' 'The countdown has finished.'" > /dev/null 2>&1 & disown
21+

0 commit comments

Comments
 (0)