Pomodoro Timer in Ubuntu

I finally decided to try Pomodoro technique to see how well it can improve my productivity as I am a lot disorganised, lazy sorta geek (well who isn't?). So I built up a small script which acts as a Pomodoro timer for me using Ubuntu notification system (Do read it if you haven't, you need to install lib-notify package for this script to work).

I have created a launcher in my top panel, with which I start a new pomodori (name for a new period of time, lets call it a Pomodoro anyway). It calls up the script which alerts me that a new Pomodoro (time period) has started and then alert me again when the timer ends and I should take a small break.

Here is the script:

DISPLAY=:0 notify-send -t 1000 -i /home/ashfame/Dropbox/Ubuntu/icons/pomodoro.png "New Pomodoro starts" "You have 25 minutes to work."
# 25 minutes timer
sleep 1500
DISPLAY=:0 notify-send -t 1000 -i /home/ashfame/Dropbox/Ubuntu/icons/pomodoro.png "Pomodoro ends" "Take a break!"

As soon as I click the launcher, the first notification appears telling me that a new Pomodoro has started.

pomodoro starts

Then it sleeps for 1500 secs = 25 minutes. And after that the second notification appears telling me that the Pomodoro has ended.

pomodoro ends

I just take a 3-5 minutes break or even longer (I am the boss!), and then I again click on the launcher starting another Pomodoro and I work for another 25 minutes. You can use the same tomato icon, if you want.


Enjoy the awesomeness of Ubuntu and ditch Windows, yes I am an Ubuntu advocate and will push you to switch all the time ๐Ÿ˜›

Have your say in the comments!

Using Ubuntu Notification System – NotifyOSD

Ubuntu features a notification system, where you can see a message notifying you about some particular event. Rhythmbox uses it to show the next track when a track ends, Filezilla shows a notification that file transfers are completed when its window is not in focus (Very handy!) and so on several applications can use it to notify users in the same way (keeping the UI consistent, which is a good design principle).

Rhythmbox Song Notification

rhythmbox notify

Filezilla Transfer Complete Notification

filezilla notify

We too can use this easily in our shell scripts. It supports more functionality if you are working in Python or C (Read Ubuntu NotifyOSD) but for shell scripts it does the pretty fine job too, if you just want to make Ubuntu work for you.

Using NotifyOSD in shell scripts

Make sure you have libnotify-bin installed, if not, just install it by typing the following command in a terminal:

sudo apt-get install libnotify-bin

notify-send - Program to send desktop notifications

With notify-send you can sends desktop notifications to the user via a notification daemon from the command line. These notifications can be used to inform the user about an event or display some form of information without getting in the userโ€™s way.

Check out the man page for it, to see the options it has to offer - man notify-send

Enter this in a terminal, notify-send "Hello" "this is just a test" and you will see the notification appearing up on your desktop.I usually collect icons that I would like to use and then use them in notification bubbles in the following manner:

In terminal, you can use it like

notify-send -t 2000 -i /home/ashfame/Dropbox/Ubuntu/icons/console.png "Hello Ashfame" "This is your computer, lets start with work"

In a shell script, use it like (take care of the screen where you want to display the message - I am on a dual screen setup)

DISPLAY=:0 notify-send -t 2000 -i /home/ashfame/Dropbox/Ubuntu/icons/console.png "Hello Ashfame" "This is your computer, lets start with work"

notify example

Time parameter (-t) lets you specify the time in miliseconds after which the notification will fade away. Its affected with a bug right now (will work on the default timeout even if you set it, but will be fixed in upcoming releases anyway, so better use it).

Icon parameter (-i) is used to specify the icon which is to be used in the notification.

You can also use it to notify you when a certain command has completed in the terminal, like when you were compiling some code or anything which takes a good amount of time so that you can get to know the moment it is ready. As an example, you can use it like

make && notify-send "DONE"

Making practical use of NotifyOSD using notify-send

You can create shell scripts for additional functionality you want, right? Just use notify-send where you want you to be informed or alerted.

Here are the examples, where I use them:

  1. WordPress new version alert
  2. Alert if my site is down
  3. Health check - Tells me to take breaks, sleep at night and if I resist, lock the screen
  4. Pomodoro technique for quantizing time for increasing productivity
  5. Random fun facts from randomfunfacts.com

You can build a lot more useful stuff as per your needs. Share your ideas in the comments and we can discuss ๐Ÿ™‚