Ubuntu Stopwatch Applet


It has occured to me several times that I would like to have a small stopwatch utility with quick access (particularly for time tracking on various projects). I figured the Ubuntu timer applet would have this function, but alas, it did not. To my surprise, there wasn’t any applet in the ubuntu repositories that does this. I decided it would be sufficiently useful to look into writing one myself. As usual, documentation was pretty sparse but I managed to find a good starting point and cobbled together a simple proof of concept. I’d tell you how much time it took, but I didn’t have a handy stop-watch applet for me to time myself.

You can find the code in my redmine here. Compile with gcc or just run make.sh (it’s only one line). The .server file needs to go in /usr/lib/bonobo/servers. It also needs to be edited to point to wherever it is that you put the binary. After moving it, log out and then back in. Right click on the panel you want to add it to and select “add to panel”. You should see “Stopwatch Applet” in the list.

Add To Panel

Add To Panel Dialog

It’ll drop the simple applet on your panel. The applet steals the “timer-applet.png” image from the timer applet package so you might need that in /usr/share/pixmaps in order for the entry to show up in your list of available applets. The applet looks like this:

Panel

The Stopwatch Applet

There are basically no features. It starts counting when it’s loaded. You can click on it to reset it. I do have some planned improvements for when I get around to it.

  • Ability to control multiple timers from one instance
  • Ability to choose which timer is displayed in the panel
  • Ability to pause/lap/resume by clicking on it (configurable)

Also, just in case you were wondering, I spent a total of 23 minutes and 49 seconds on putting this code in version control, adding the project to redmine, and writing this post.

  1. #1 by wdev on August 16, 2011 - 10:16 am

    Hi, what is the licence of your applet? I was looking for a thing like that but it’s impossible to find anything… Unfortunately this one doesn’t work under Unity. Do you mind if I create an github repository and try to adapt it?

    • #2 by cheshirekow on August 16, 2011 - 2:43 pm

      Share and share-alike. I’ve been meaning to put license blocks in my codes but haven’t gotten around to it. Feel free to fork the repo. Actually, I haven’t set up git over http yet, so maybe you’ll just have to download the files. Either way, yeah, go ahead.

      I haven’t looked into unity yet. I tried it out but didn’t like that it was so laggy. I’ve seen several comparisons of unity to gnome-3, so I suspect unity is based on gnome-3. This applet was made for gnome-2, so perhaps thats why it doesn’t work. Maybe the API is changed.

  2. #3 by Stud on June 9, 2012 - 1:17 pm

    Thanks for this. It’s just what I wanted, an elegant, simple and light weighted chronometer for my Ubuntu. Great!

(will not be published)