Terminal multiple countdown timer app for Bash / Zsh
Solution 1
You can combine tmux or screen with termdown.
Termdown is an ncurses timer.
http://www.slashgeek.net/2016/10/25/termdown-cli-countdown-timer-stopwatch/ shows how termdown works.
tmux and screen allow you to run multiple countdowns at once.
I'd make scripts like
~/.bin/pomodoro:
#!/bin/sh
termdown 25:00 && mplayer /path/to/sound.mp3
~/.bin/5minbreak:
#!/bin/sh
termdown 05:00 && mplayer /path/to/break.mp3
And, I'll execute pomodoro
in a tmux or screen window.
That way, I can create multiple countdowns.
Do you want notifications? You can combine notification commands with termdown, too.
I'd set up multiple tmux windows for specific timers in advance.
Solution 2
From terminal use the "at" command to set your timer, "at" is very flexible for it can be used with both absolute and relative time (for more info: man at
):
at now + 1 minute <<<'notify-send ALARM'
"notify-send" will place a notification on your desktop
(feel free to replace it with i.e. "aplay" to make a sound instead of a notification).
Solution 3
There is a bash script here in Ask Ubuntu called multi-timer
multi-timer
Progress bar display
Features
- Retains configuration between uses.
- Up to 19 timers run sequentially in a set.
- Progress bar for each timer.
- Set of timers can be run multiple times.
- Progress bar for set.
- Progress bar for all sets.
- Optional prompt to start each timer and/or set.
- Optional pop-up message when each timer and/or set ends.
- Optional alarm when each timer and/or set ends.
- Optional lock screen when each timer OR set OR all sets end.
- Optional interface to Sysmonitor Indicator so Systray shows countdowns.
- Optional close progress bar display when all sets of timers end.
Visit the link above for screenshots and bash code.
![somethis](https://i.stack.imgur.com/YZwet.jpg?s=256&g=1)
somethis
Just a regular Ubuntu/Linux user - so no Windows here :) I like jamming on my guitar. Looking forward to exchanging some experience here.
Updated on September 18, 2022Comments
-
somethis almost 2 years
I'm looking for an app to organize my daily tasks in different countdown timers similar to the one found at www.timeanddate.com/timer/
Features I'm looking for would be:
- runs in terminal bash or zsh
- multiple independent countdown timers
- plays a sound or notification display once a timer runs out
Please note that timetracking is not an important feature, just the countdown is enough.
Thank you.
-
somethis over 7 yearsGreat answer, I like the simplicity. Is there any way to display the time left (like a countdown), too?
-
thom over 7 yearsno, not with "at". if you would like to have a shell-window constantly open to be able to check the countdown time, you're probably better of with a while loop and the sleep command.
-
wjandrea about 6 yearsThis doesn't need to be a function, so it should be a script. But if you do want to leave it as a function, you should run it in a subshell to prevent affecting the variables in the interactive shell.
-
Dreamcat4 almost 5 yearsHey there @crocket. Have just found termdown today. If you look at my answer I have now updated it to include the running termdown for that functionality. Just a bit more creature comforts for a more pleasant user experience.
-
Paul Rougieux over 3 yearsA superuser question superuser.com/questions/611538/… gives a basic loop
N=100; while [[ $((--N)) > 0 ]]; do echo $N && sleep 1 ; done
many more elaborate answers under that question. -
somethis over 3 yearsThank you, just discovered your answer and love the solution!
-
somethis over 3 yearsCan anyone confirm this solution?
-
WinEunuuchs2Unix over 3 years@somethis I wrote the script. It's been working every Wednesday night for two years. If you have any questions don't hesitate to ask.
-
somethis over 3 yearsNice, thank you! Runs perfectly and I marked it as a solution to the question. Very nice script, carefully crafted.