{"id":502,"date":"2011-04-03T07:50:31","date_gmt":"2011-04-03T14:50:31","guid":{"rendered":"http:\/\/albertomilone.com\/wordpress\/?p=502"},"modified":"2011-04-03T07:50:31","modified_gmt":"2011-04-03T14:50:31","slug":"appindicator-for-hamster","status":"publish","type":"post","link":"https:\/\/albertomilone.com\/blog\/appindicator-for-hamster\/","title":{"rendered":"Appindicator for Hamster"},"content":{"rendered":"<h3>Premise<\/h3>\n<p>I use Hamster for time tracking at work and the lack of an applet which works with Unity&#8217;s panel is my main obstacle to the adoption of Unity (which I love BTW). For this reason I hacked on the applet&#8217;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. <span style=\"text-decoration: underline;\">I wasn&#8217;t aiming for the perfect example of usability<\/span> 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.<\/p>\n<p><strong>Note:<\/strong> I know that there was a <a href=\"https:\/\/bugs.launchpad.net\/ubuntu\/+source\/hamster-applet\/+bug\/686062\">discussion about integrating Hamster in the Clock indicator<\/a> but, as I said, this wasn&#8217;t my objective, even though I do not exclude future evolutions of the indicator in this direction. I should talk to upstream too.<\/p>\n<h3>Implementation<\/h3>\n<p>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&#8217;s applet.py) and to override the parts that I didn&#8217;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).<\/p>\n<h3>Results<\/h3>\n<p>As you can see, the indicator is very simple. I just re-used the icon from Hamster but I&#8217;d love to see a monochromatic one instead.<\/p>\n<p><a href=\"http:\/\/albertomilone.com\/wordpress\/wp-content\/uploads\/2011\/04\/hamster_icon_final.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-504\" title=\"hamster_icon_final\" src=\"http:\/\/albertomilone.com\/wordpress\/wp-content\/uploads\/2011\/04\/hamster_icon_final.png\" alt=\"\" width=\"368\" height=\"210\" \/><\/a><\/p>\n<p>Click on the &#8220;New activity&#8221; menu item and you&#8217;ll get the old activity dialog near the indicator. I had to make the dialog a decorated window as, otherwise, you wouldn&#8217;t have a way to hide the dialog without a panel button, if, for example, you clicked on that menu item by mistake. Clicking &#8220;Start Tracking&#8221; still hides the dialog.<\/p>\n<p>Personally, I&#8217;d like to see something smaller than the following dialog, for example without all that&#8217;s below the &#8220;Today&#8221; 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&#8217;m digressing now&#8230;<\/p>\n<p>&nbsp;<\/p>\n<p><a href=\"http:\/\/albertomilone.com\/wordpress\/wp-content\/uploads\/2011\/04\/hamster_new_activity1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-507\" title=\"hamster_new_activity1\" src=\"http:\/\/albertomilone.com\/wordpress\/wp-content\/uploads\/2011\/04\/hamster_new_activity1.png\" alt=\"\" width=\"551\" height=\"202\" \/><\/a><\/p>\n<p>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 &#8220;Add earlier activity&#8221; and &#8220;Show Overview&#8221; dialogs are still there.<\/p>\n<p><a href=\"http:\/\/albertomilone.com\/wordpress\/wp-content\/uploads\/2011\/04\/hamster_activity_final1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-506\" title=\"hamster_activity_final1\" src=\"http:\/\/albertomilone.com\/wordpress\/wp-content\/uploads\/2011\/04\/hamster_activity_final1.png\" alt=\"\" width=\"368\" height=\"210\" \/><\/a><\/p>\n<p><strong>Note:<\/strong> the screenshots in this blog post were taken in Maverick 10.10.<\/p>\n<h3>How to try it<\/h3>\n<p>I haven&#8217;t had the time to package it yet but you can simply download the &#8220;hamster-indicator&#8221; file from the git repository below, make it executable, double click on it and select &#8220;run&#8221; (at least in Gnome). You also need to have the &#8220;hamster-applet&#8221; package installed.<\/p>\n<p>The code is <a href=\"https:\/\/github.com\/tseliot\/hamster-appindicator\">hosted here<\/a>.<\/p>\n<p>I&#8217;ll package it and put it in a PPA soon.<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Premise I use Hamster for time tracking at work and the lack of an applet which works with Unity&#8217;s panel is my main obstacle to the adoption of Unity (which I love BTW). For this reason I hacked on the applet&#8217;s code in my (very limited) spare time at weekends and I managed to get <a class=\"read-more\" href=\"https:\/\/albertomilone.com\/blog\/appindicator-for-hamster\/\">[&hellip;]<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[14,5,6,9],"tags":[],"class_list":["post-502","post","type-post","status-publish","format-standard","hentry","category-gnulinux","category-planet","category-python","category-ubuntu"],"_links":{"self":[{"href":"https:\/\/albertomilone.com\/blog\/wp-json\/wp\/v2\/posts\/502","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/albertomilone.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/albertomilone.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/albertomilone.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/albertomilone.com\/blog\/wp-json\/wp\/v2\/comments?post=502"}],"version-history":[{"count":0,"href":"https:\/\/albertomilone.com\/blog\/wp-json\/wp\/v2\/posts\/502\/revisions"}],"wp:attachment":[{"href":"https:\/\/albertomilone.com\/blog\/wp-json\/wp\/v2\/media?parent=502"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/albertomilone.com\/blog\/wp-json\/wp\/v2\/categories?post=502"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/albertomilone.com\/blog\/wp-json\/wp\/v2\/tags?post=502"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}