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.

[caption id="attachment_544" align="aligncenter" width="477" caption="Add To Panel Dialog"]![Add To Panel](http://www.cheshirekow.com/wordpress/wp- content/uploads/2011/07/screenshot_add_to_panel.png)[/caption]

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:

[caption id="attachment_545" align="aligncenter" width="299" caption="The Stopwatch Applet"]![Panel](http://www.cheshirekow.com/wordpress/wp- content/uploads/2011/07/screenshot_panel.png)[/caption]

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.

Comments


Comments powered by Disqus