Hamster is one of my favorite apps in Linux. I use it so much that I had previously written a post on it at Time Tracking in Linux using Hamster. One of the problems, I faced when I installed Natty was that it does away with the notification area (or systray). This means that the hamster applet will not be loaded in the panel automatically.
In the Launchpad, there exists a bug that discusses ways to add indicator support to Hamster. The author of Hamster has indicated that ,for now, he is not going to write a version for GNOME 3.0 (using GNOME Shell). I took a look at the code and it seems interesting – although I am not fully familiar with hamster graphics methods. If Unity support is not built into hamster in the near future, I will take a stab at it. In this article, I discuss some workarounds to still use Hamster in Ubuntu Unity or GNOME Shell . They range from the easiest to hardest.
If you are using Ubuntu Unity, the best alternative is to use the hamster version developed by Alberto Milone. The description of his work is this page – Appindicator for Hamster . Basically, he created a child class of HamsterApplet which has appindicator support. Pretty neat ! I browsed through the code and it seems straightforward. Hopefully, it will go into the upstream.
The instructions to use it are given in the linked page. Basically, you download the python code from hamster-appindicator’s github page. If you do not know how to use git , then just download the raw Python file . Put it in some folder and invoke it as "python hamster-indicator.py &". You can also add it to your Ubuntu startup applications !
Since hamster applet is nothing but a Python app, you can technically invoke it as a standalone application instead of an applet. Most of the time, the utility must be in your path. You can invoke it as "hamster-time-tracker &" (or "python /usr/bin/hamster-time-tracker &") and by default, it will open a new stand alone window for the tracker. One thing to notice is that, this view does not have the "Add earlier activity" button. So this is only useful , if you want to add tasks starting now. Or you can muck around with Hamster’s use of negative time (-x a@b,c means I have been doing activity a of category b with description c for the last x minutes).
If you want to add earlier activities, invoke hamster as ,
There are other options also. The entire list is overview|statistics|edit|preferences|about|toggle . The overview mode opens the "Overview" window that allows you to browse your activities for this week/month etc. The statistics mode shows a chart of your activities. The edit mode opens a new window that usually shows up when you click on "Add new activity". It allows you to enter activity,category, description, tags starting at arbitrary time.
The only catch is that it does not always visible and hence you might forget that it even exists ! If you are not as absent minded, then this is the best way to go (especially in GNOME 3.0 or GNOME Shell).
Use this method, if none of the above works. This is only for masochistic hardcore geeks. The basic idea is to use the hamster-service that runs in the background and use the hamster’s command line utility. Just invoking the command line tool "hamster-cli" will give you a list of options. They are :
(1) list-activities : You can invoke this option to list all the activities and their respective categories. The format of output is activity@category . This is useful if you want to add a category using command line. The invocation is
(2) list-categories : This will show a list of all available categories. Usually this is superfluos as list-activities gives you the categories also.
(3) stop : This stops the task that is currently being tracked by hamster.
(4) list : This , by default(without arguments) , shows all the activities tracked for today. You can also give hh:mm-hh:mm option to display activities between specific time.
hamster-cli list 00:00-12:00
The first shows all of today’s tracked tasks while the second shows till 12 PM.
(5) start : The most important switch. This allows you to add a new activity – This can start now or at an earlier time. The format of entry is to give a activity with its category, optionally start time and description.
Currently, you cannot add new category or activity types using hamster-cli. You can only add/track a task using existing activity/category. If you want to add new activity/category use "hamster-time-tracker preferences" command to open Hamster’s preferences dialog which will allow you to do that .
hamster-cli start "Blogging@Blogging"
hamster-cli start "Blogging@Blogging,Hamster Post" 19:00-21:00
hamster-cli start "Blogging@Blogging,Hamster Post" -00:40:00
The first invocation starts a new ongoing task of activity type Blogging and category type "Blogging" (after the @). The second invocation adds an earlier task of blogging between 7-9 PM. The third invocation starts a new task of blogging that started 40 minutes ago and still ongoing.
Hamster allows a more sophisticated time specification mechanism for start. I will put the details verbatim from the help of hamster-cli.
* ‘YYYY-MM-DD hh:mm:ss’: Absolute time. Defaulting to 0 for the time
values missing, and current day for date values.
E.g. (considering 2010-03-09 16:30:20 as current date, time):
2010-03 13:15:40 is 2010-03-09 13:15:40
2010-03-09 13:15 is 2010-03-09 13:15:00
2010-03-09 13 is 2010-03-09 00:13:00
2010-02 13:15:40 is 2010-02-09 13:15:40
13:20 is 2010-03-09 13:20:00
20 is 2010-03-09 00:20:00
* ‘-hh:mm:ss’: Relative time. From the current date and time. Defaulting
to 0 for the time values missing, same as in absolute time.
To see other information, type "hamster-cli" without any arguments in the command line. It will show a helpful list of commands.
One of the comments in the Launchpad asked for Hamster to behave like a docky helper. If thats your thing, follow the instructions at this page . I have not personally tried it but hopefuly it will work.
This is something I tried but did not work. Basically, I tried to add hamster to the whitelist of applications that are allowed to use notification area in Unity. You can find the details of how to enable any application to use systray at this askubuntu question.
I tried entering various incantations like hamster,Hamster,Time Tracker,hamster-time-tracker, hamster-tracker and so on. Somehow none of these worked. If anyone got it to work please let me know in the commands.
In conclusion, Hamster is one of the coolest apps in Linux and this post discusses some workaround for using it in Unity or GNOME 3.0 /GNOME Shell. Hopefully, indicator support will be built in the upstream itself soon. Have fun with Hamster !