Appindicator for Hamster

Premise

I use Hamster for time tracking at work and the lack of an applet which works with Unity’s panel is my main obstacle to the adoption of Unity (which I love BTW). For this reason I hacked on the applet’s code in my (very limited) spare time at weekends and I managed to get what I needed i.e. a functioning appindicator for Hamster. I wasn’t aiming for the perfect example of usability but simply an indicator which could reproduce the functionality of the old applet, therefore feedback is more than welcome from the design team, design enthusiasts, etc.

Note: I know that there was a discussion about integrating Hamster in the Clock indicator but, as I said, this wasn’t my objective, even though I do not exclude future evolutions of the indicator in this direction. I should talk to upstream too.

Implementation

I adopted a rather opportunistic (call it hackish) approach to the problem. Rather than duplicating code or patching the original code, I chose to create a subclass of the HamsterApplet class (from Hamster’s applet.py) and to override the parts that I didn’t deem suitable for the indicator (such as the panel button and the sticky activity window). Long story short, the code in Hamster does all the heavy lifting while my code deals mainly with keeping the indicator updated. A proper solution would probably involve creating a more generic class which both the HamsterApplet class and my new class can inherit, assuming that this is the path that upstream want to follow (as they might have different plans in mind, especially on the user interaction side).

Results

As you can see, the indicator is very simple. I just re-used the icon from Hamster but I’d love to see a monochromatic one instead.

Click on the “New activity” menu item and you’ll get the old activity dialog near the indicator. I had to make the dialog a decorated window as, otherwise, you wouldn’t have a way to hide the dialog without a panel button, if, for example, you clicked on that menu item by mistake. Clicking “Start Tracking” still hides the dialog.

Personally, I’d like to see something smaller than the following dialog, for example without all that’s below the “Today” expander (included) and with the remaining elements arranged in a more space efficient way. Or maybe we could have something other than a dialog to do this (e.g. integration with the Unity dash?). I’m digressing now…

 

This is the indicator in action. You can click on the activity name so as to get a dialog to edit the current activity or you can also decide to stop the task from the indicator. Of course the old “Add earlier activity” and “Show Overview” dialogs are still there.

Note: the screenshots in this blog post were taken in Maverick 10.10.

How to try it

I haven’t had the time to package it yet but you can simply download the “hamster-indicator” file from the git repository below, make it executable, double click on it and select “run” (at least in Gnome). You also need to have the “hamster-applet” package installed.

The code is hosted here.

I’ll package it and put it in a PPA soon.

 

29 thoughts on “Appindicator for Hamster

  1. Really cool!

    I had toyed with the idea of making it into an indicator as well, but never really got very far due to lack of time.

    Just one idea though, have you considered devising a way to have the activity entry in some work of widget like the one in the Me Menu for identica and all?

  2. Alberto,

    thanks so much! That works great on my laptop running 11.04 and Unity!

    The only addition I would appreciate is to change the icon if hamster is currently tracking an activity (active) or if it is running without tracking (inactive). For instance, the the icon in an inactive state could be monochrome and when running, a colored icon could be shown. I just quickly sketched two icons and uploaded them at http://ubuntuone.com/p/pqB/

    The rest is just perfect!

    Thanks again and keep up the great work!

    Cheers,

    Philip

  3. This works fine for me. I’ve added it as a start-up programme too so it loads automatically.

  4. Thanks! That is exactly what I needed. I like Unity but the lack of support for the old applets is killing me, you just saved me time getting this running on my own.

  5. Hi Alberto, thanks for creating this, it’s great. I’ve just got it up and running on my laptop.

    Any update on when you plan on packaging it?

  6. Hi Alberto. Your indicator works like a charm. Thanks for the work done.

    BTW, is there any way to keep the Super+H combination working as usual with unity?

  7. Hi, first off thank you for all your hard work in getting this extremely useful application to work. It’s enhanced my life and I’m sure many others.

    I would like to know if you can update to the latest release of 2.92 since there are better template features for the reports. Any idea if this is going to be in the works?
    Thanks again,
    -Nick

Leave a Reply

Your email address will not be published. Required fields are marked *