My favorites | English | Sign in

Google Desktop APIs (Labs)

Maximize Usability of Minimized Desktop Gadgets

This article was written and submitted by an external developer. The Google Desktop Team thanks Rodrigo Costa for his time and expertise.


Rodrigo Costa, Google Desktop Developer
March 2008

Introduction

When developing a new gadget, we should pay attention to this fact: the average user has multiple gadgets in the Sidebar, and a power user has yet even more. Because space is limited, users typically keep a few gadgets in a minimized state. As gadget developers, we have to take this issue in consideration to improve the usability of our gadgets.

What happens in the minimized state

When a gadget is minimized, it collapses to save space. It displays the gadget's small icon and the contents of view.caption attribute within the title. In this state, some functions such as framework.audio.play are disabled. However, if you have a gadget that uses a timer to periodically retrieve information, you have to realize that the timer continues to run even when the gadget is minimized.

State change events

For the minimize/un-minimize transitions, the Google Desktop API provides some useful "hooks":

Within these events, you can do intelligent things such as halting animations or intensive computations. However, this article focuses on updating the minimized title content, which can be done without handling any events.

Examples

Gadget minimized
Figure 2: AdSense Tracker Gadget minimized
Gadget not minimized
Figure 1: AdSense Tracker Gadget

The AdSense Tracker gadget has an hourly timer that updates your earnings of the day in the Google AdSense program. When the gadget is operating normally (Figure 1), you can see yesterday's earnings, monthly earnings, and other information.

Now in Figure 2, you can see that when the gadget is minimized, it displays the most useful statistic in the title, which is your earnings today. Even when minimized, the gadget is useful to the user and helps to conserve space in the Sidebar. This should be a concern for every gadget you develop: "Can the gadget provide a valuable service to the user at all times?"

Below is the code that sets the gadget's title:

  view.caption="Adsense-US$ "+earnings;

Let's look at another example. Suppose you have a digital clock gadget. The code below updates a label in the gadget to display the current time:

function view_onOpen() {
  clock();
}

function clock(){
  var date = new Date();
  var minute = date.getMinutes();
  var hour = date.getHours();
  var second = date.getSeconds();

  label1.innertext = hour + ":" + minute + ":" + second;
  view.setTimeout(clock, 1000);
}

The timer fires every single second. Now, if the title is some static text such as "Digital Clock", and the gadget is minimized, the gadget won't be of any value to the user. But if you instead show the current time in the title, the gadget will remain useful when minimized.

function clock(){
  var date = new Date();
  var minute = date.getMinutes();
  var hour = date.getHours();
  var second = date.getSeconds();

  view.caption = "Digital Clock - " + hour + ":" + minute + ":" + second;
  label1.innertext = hour + ":" + minute + ":" + second;
  view.setTimeout(clock, 1000);
}

Conclusion

Before you release a new gadget, you should think on how it behaves when minimized. This is one important aspect of maximizing the usability of a minimized gadget. After reading this article, I hope you will consider using view.caption when maximizing the usefulness of your own gadget.

Author Bio

Photo of Rodrigo Costa

I am an enthusiast of technology since the 80's...today I mostly work on Internet development with ASP, PHP, PERL, .NET...and the improvement of my sites on Google AdSense. Like all here, I am also a big Google fan. Quote: If an elderly but distinguished scientist says that something is possible, he is almost certainly right; but if he says that it is impossible, he is very probably wrong. (Arthur C. Clarke) You can see my gadgets on my website. Also, please visit my Adsense Tracker gadget.


Creative Commons License
This work is licensed under a Creative Commons Attribution-No Derivative Works 3.0 United States License.