Devnotes > Basic pomodoro timer in bash with termdown and wmctrl

Like many other systems that aim to add some structure in the chaos of todo-items that we all struggle with, the Pomodoro Technique has some good parts and ideas, but one must be careful not to drive it to far. Neither by forcing every life problem in the system (if all you have is hammer...), nor by a too rigid application of the rules of the system. The same goes for the apps and tools that come with it.

After some failed attempts to install i3-pomodoro, where I first had to upgrade my i3status to i3blocks, with its own configuration and all, I realized I just wanted one very simple thing from Pomodoro: a timer that lets me do some focused work for a certain period of time. Nothing more. For simple things, Bash is still the best:

#!/bin/bash
MINUTES=25
if [ "$1" == "break" ]; then
  MINUTES=5
fi
wmctrl -N "Pomodoro" -r :ACTIVE:
termdown --no-figlet --no-seconds --no-window-title ${MINUTES}m 
wmctrl -b add,demands_attention -r "Pomodoro"

This runs a terminal timer that counts down to zero from a specified amount of minutes and then lets the window manager draw attention to it in it's native way. In default i3 this means the border turns red, as well as the workspace indicator in the status bar.

Then the timer termdown is started:

After the countdown, we let wmctrl draw the attention:

Sources