Last year I discovered the website Wakoopa.com. At first I didn’t quite get the usefulness of using Wakoopa but after using it I really came to love it. Wakoopa let’s you broadcast your software activity usage by installing a little tray icon. On your Wakoopa profile you can track your software usage trends. Since I’m a proud Mac user and believe in radical transparency I am broadcasting the usage of my software to the world:

Right now on this blog you can see my Latest Tweets and Interesting Links. That data get’s updated everytime I bookmark something (using Delicious) or tweet something (using Twitter). I really like the real-time and heartbeat aspect of it.

While taking a shower a couple of weeks ago I was thinking of using the Wakoopa data to make a little widget. Most of my time is spend in front of my Macbook, so it would be nice to display what I’ve been doing the last hours on my Mac. I want to display it in a simple single sentence like “Recently I’ve been programming”. I don’t want to overload my visitors with too much data. Of course when they click on the sentence they are taken to my Wakoopa profile

I contacted the Wakoopa team a couple of weeks ago to ask whether they could provide this activity data in form of a JSON feed (essential for making a badge/widget). They replied to me within a couple of hours and implemented it! That’s agile baby! Unfortunately I wasn’t so agile on my private projects and only build my widget yesterday.

Using the just released Wakoopa JSON api I’ve written a big ugly piece of Javascript that serves as the widget:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<script type="text/javascript">
  var wakoopa_activity = {'Design': 'designing',
                          'Communication': 'mailing and chitchating',
                          'Browsers': 'surfing the web',
                          'Programming': 'coding like hell',
                          'Audio': 'slacking off',
                          'Video': 'slacking off', // jacking off? 
                          'Tools': 'doing some funky stuff'}
  var wakoopa_username = null;
  
  function wakoopa_doing_now(data) {
    var app = null;
    var activity = '';
    for(var i = 0; data.length > i; i++) {
      if (app == null || app.active_seconds <= data[i].active_seconds) {
        app = data[i];
      }
    }
    if(app.category) {
      activity = wakoopa_activity[app.category.name];
      if (!activity) {
        activity = app.category.name;
      }
      if (app.category.name == 'Tools') {
        if (app.name == 'iTerm' || app.name == 'Terminal') {
          activity = 'unix fu';
        }
      }
    }
    title = 'my software usage on wakoopa.com';
    document.getElementById('wakoopa_activity').innerHTML = '<a href="http://wakoopa.com/' + wakoopa_username + '" alt="' + title + '" title="' + title + '">Recently I\'ve been ' + activity + '.</a>';
  }
  
  function wakoopa_recent_activity_for(username) {
    var script = document.createElement( 'script' );
    wakoopa_username = username;
    script.type = 'text/javascript';
    script.src = 'http://wakoopa.com/' + username + '/recently_used.json?callback=wakoopa_doing_now';
    document.getElementsByTagName('head')[0].appendChild( script );
  }
</script>
<img style="float: left; margin-right: 6px" src="http://wakoopa.com/favicon.ico"/>
<div id="wakoopa_activity"></div>
<script type="text/javascript"> wakoopa_recent_activity_for('dominiek'); </script>

You can copy and paste this in your blog to display what you’ve been doing recently on your machine. Make sure to replace my username with yours.