Simple Pomodoro Timer Bash Script

This is a simple timer script, implementing the pomodoro technique for time management. There are tons out there already but I didn’t like how they auto- started breaks. And most lacked shortcut abilities, so that was a dealbreaker.

  • The script takes the number of seconds as an argument. e.g. 300 for 5 minutes.
  • It changes the window title so you can see the countdown in the window bar.
  • Plays a sound when it starts and when it ends

I’m using it bound to keyboard shortcuts, so I can use hotkey-1 for 5 minutes, hotkey-3 for 15 minutes, etc.

You’ll need to first install these guys:

sudo apt install figlet vorbis-tools

And then copy and paste this into

if [ "$1" = "stop" ]; then
	echo Stopping
	killall $(basename $0)
	exit 1
if [ -z "$1" ]; then
	echo "Must give a number for the countdown (in seconds)"
	echo "   e.g.$0 300 # five minute countdown"
	exit 1
# thanks
convertsecs() {
	if [ "$1" -gt 3600 ]; then
		printf "%02d:%02d:%02d" $h $m $s
		printf "%01d:%02d" $m $s
wintitle () {
	echo -e '\033]2;'$1 - $0'\007'
funk () {
	printf "\033c"
	figlet -cf big "$1"
origconverted=$(convertsecs $num)
countdown () {
	convertednum=$(convertsecs $num)
	disp="$convertednum / $origconverted"
	wintitle "$disp"
	funk "$disp"
	sleep 1
	let num=$num-1
soundoff () {
	ogg123 /usr/share/sounds/LinuxMint/stereo/$1 -q &
soundoff window-slide.ogg
while [ $num -gt -1 ]; do
soundoff phone-incoming-call.ogg

And the recommended way to launch this (using a keyboard shortcut or whatever) is:

gnome-terminal -- bash -c " 300; exec bash"