Timer Applet 2.0

Update: Fixed layout of example code.

So…first blog entry. :) Let’s get to the good stuff: Timer Applet 2.0!

I’m really excited about this release because it brings some extra polish that I’ve been meaning to add for a long time. I’ve re-written the entire applet in Python, so there are definitely some drastic under-the-hood changes, but let’s talk about the user-visible changes.

Here’s a quick overview:

  • New icon
  • Countdown animation with a “pie” meter
  • One-click selection of timer presets
  • Streamlined saving of new presets
  • Cleaner first-time experience with the Start Timer dialog
  • After a timer finishes, periodically redisplay the notification bubble until the user stops the timer
  • GConf option for notification beep using internal speakers (this needs verification)
  • D-Bus API

New Icon
I’m no artist, but I tried my best to make something decent. I think it’s at least an improvement over the old one. :)

timer-applet-logo-old-no-alphatimer-applet-logo-no-alpha
old icon vs. new icon

Countdown Animation
A running timer will now show a “pie” meter that will indicate how much time is remaining.

timer-running-showing-time

One-Click Presets
Previously, if you wanted to load a preset in the Start Timer dialog, you would have to double-click a preset or highlight it and click ‘Load Selected Preset’. Now, each item in the list of presets is a button that you can just click once to load the preset. Fewer clicks and we no longer need that ‘Load Selected Preset’ button cluttering up the dialog.

start-timer-dialog-oldstart-timer-dialog
old vs new Start Timer dialog

Streamlined Saving of Presets
The most common thing you would probably need to do in the Start Timer dialog is create a preset, so now there’s a ‘Save as Preset’ button that will create a preset out of the duration and name that you currently have entered in the fields. You can now create a preset from the comfort of the Start Timer dialog. The ‘Add’, ‘Edit’, and ‘Delete’ buttons have been replaced with a ‘Manage Presets’ button that will take you to the Manage Presets dialog, where you get access to all of the preset management options.

Cleaner First-Time Experience
A brand-new user, with no presets, will see a simplified Start Timer dialog without the presets list (if there are no presets, then why show it, right?). The list of presets will only appear if there is at least one preset.

start-timer-dialog-first-time

Periodic Redisplay of Notification Bubble
After a timer finishes, the notification bubble will keep reappearing until you click on the button to stop the timer. This is just another way to remind the user that the timer has finished, in addition to the blinking timer. BTW, the blinking happens faster now, so that it’s more noticeable.

Internal Speaker Beep
I’ve added a GConf setting for making your internal PC speaker beep when a timer finishes. Since this probably won’t be used by many people, I chose not to expose it in the UI. My computer doesn’t have an internal speaker though, so I haven’t been able to test this feature. Please give it a try and let me know if it works. :) You can find the GConf key here:

/apps/panel/applet_*/prefs/play_beep

where * is some integer. It’s up to you to figure out which GConf entry corresponds to your current instance of Timer Applet. :) Or you can use the D-Bus API to figure it out….

D-Bus API
You can now use D-Bus to get the list of timer IDs (an ID looks like ‘applet_*’, where * is some integer; this is the same as the applet’s GConf key). With the timer ID, you can get the corresponding Timer object and use it to start, pause/continue, or stop a Timer Applet instance.

Here’s some sample code:

#!/usr/bin/env python

import dbus

bus = dbus.SessionBus()timer_manager = bus.get_object('net.sourceforge.timerapplet.TimerApplet',                               '/net/sourceforge/timerapplet/TimerApplet/TimerManager')timer_id_list = timer_manager.GetTimerIDList()if len(timer_id_list) > 0:    first_timer_id = timer_id_list[0]    print 'Starting timer with ID: %s' % first_timer_id

    timer = bus.get_object('net.sourceforge.timerapplet.TimerApplet',                           '/net/sourceforge/timerapplet/TimerApplet/Timers/' + first_timer_id)

    # Start() takes: name, hours, minutes, seconds    # Name can be an empty string.    timer.Start('Laundry', 0, 45, 0)else:    print 'There are no Timer Applets in the panel.'

The TimerManager has only one method: GetTimerIDList().

Each Timer has these methods:

  • Start(name, hours, minutes, seconds)
  • PauseContinue()
  • Stop()

I tried to keep the API as simple as possible, so if it doesn’t meet your needs, let me know and I’ll try to work something out.

Phew, that was my first post. Done. :)

~ by jimmydo on April 27, 2007.

15 Responses to “Timer Applet 2.0”

  1. It’s a great applet.
    Thank’s
    Did you ask fot it to be inside the « official » gnome ? Or be include in the clock applet ?
    My wich ? I love it to be able to be a chronometer applet to. I still don’t understand why there’s not such a useful toy in gnome.

  2. Thanks Olivier. I actually haven’t ask to have Timer Applet be included in the official distribution. I wouldn’t mind if it were “offical” of course, but I’m happy just releasing it independently.

  3. Great applet, indeed. I missed it for long time in gnome. I think that it would be really nice to have it as part of official gnome, too.

    Here are few more ideas, which could make it rock even more.

    The icon could still use some more polishing to match other gnome icons. The progress icon is wonderful, stick to it.

    As soon as you open the applet, you can set up a timer by keyboard. Please add a keyboard shortcut to open the applet and to stop (pause) the timer in a similar way as it is implemented in tomboy or deskbar.

  4. Great applet! is there a way to disable the pause the restart and the others features ?

  5. @vil: I agree that the icon probably needs more work. I’m not the best artist though. If anyone wants to contribute an icon, I’d be happy to take a look!

    @dott: Are you referring to the ‘Pause’, ‘Stop’, ‘Restart’ items in the right-click menu? They don’t seem to get in the way very much. Is there a reason why you want to disable them?

  6. @vil: Just realized that I forgot to address your second feature request. :)

    Having a keyboard shortcut for opening and stopping the timer is a little trickier because, unlike Tomboy and Deskbar, it makes sense for multiple Timer Applets to be present in the panel. With multiple Timer Applets, how would we know which one a keyboard shortcut should apply to?

    For the simple case of having just one timer in the panel, I might add new D-Bus methods for manipulating the UI of specific timer instances. With that, you could write a python script that controls the first Timer Applet instance it finds. Binding that script to some keyboard shortcuts would then let you open or stop a timer using the keyboard.

    The reason why the Timer Applet currently has a D-Bus API is actually so that users can extend Timer Applet to do stuff like this. Right now, however, it only has APIs for directly starting a timer with a specific duration–it doesn’t yet have a way to show the Start Timer dialog for specifying a duration.

  7. The idea of disable the menu would be usefull in the case the admin want to use this applet just to notify the regular user the time that rest in the session, but not let him to modify it at all. This is my idea for a cybercafe control program and i think its not necesary to create a new applet if your great timer applet have the apropiate Gconf keys and functionality.
    This is just a sugestion of course and probably you didnt ever think in this use for the applet but im interested in your opinion.

  8. Newbie problem: I installed the applet using Adept Manager, but I can not find it anywhere to run! I know this is simply a “User Error” but for the life of me I can not figure it out. A “leave nothing to the imagination” guide to finding the applet, so I can add it to my menu, would be fine!

  9. frogger, this applet can be found by clicking any panel and choosing add to panel. I however am Using ubuntu Dapper Drake and installed version 1.2 from the repos and I can get no sound. Any ideas on what is up? It’s a handy program but sound would be nice. BTW Dapper does not meet the requirements for the newest version.

  10. Thank you for this applet!

  11. I am also having a problem with the sound, I am running version 2.0.1 on Debian lenny (Testing). Their is an open bug on the Debian mailing lists. Bug #408396 But no resolution (same for ubuntu)

  12. i get no sound notify. can u fix sound? it is bug 408396 in debian.

  13. bonjour
    est il possible de demarrer le “timer applet” à l’envers?
    peut-on demarrer le timer en lui donnant l’heure à laquelle nous voudrions qu’il s’arrete,
    lui meme synchronisé a l’horloge de l’ordinateur.
    can we start the time in the other side? giving him the time when we want he stop?
    can you do it please.
    thank you.

  14. why the 48hours limit? I’d like to be able to set a timer for days.

  15. Great app..

    How about an option to be a time-up?
    I can’t imagine it being too hard to do..

    I could use such a thing right now..

    I have to track the time on multiple projects that I am working on all the time.. and I am interrupted by clients, phone calls, other jobs, lunch etc.. I could have any number of timers on my desktop or toolbar.. and have them all paused… and just unpause the job I am working on at the time… When it comes to billing/timesheets… I can then just look at the timers..

    Especially if the timers were to be able to save/restore between reboot/login/logout..

Comments are closed.