Control both Apple clocks

Using the Date & Time System Preferences panel, you can display the current time either in the menu bar or as a floating window (one that lives above all other windows). Unfortuantely, it seems you can’t have both a menu bar clock and a floating clock—the choice is presented via radio buttons, and when you activate one, you lose the other. But back in the June 2004 Mac OS X Hints column, we showed you a way around this limitation.

In a nutshell, you need to navigate to the System > Library > CoreServices > Menu Extras folder, and then control-click on the Clock.menu file you’ll see there. Pick Show Package Contents from the pop-up menu, then navigate into Contents > Resources in the new window that opens. There you’ll see a program named WindowClock; double-click it, and you’ll now have a floating desktop clock, in addition to the menubar clock. (In 10.4, you can control- or right-click on the clock to choose between analog or digital modes; in 10.3, control-click doesn’t work for some reason, but a right-click does, if you have a multi-button mouse.)

But that’s the old tip. Today’s tip is on how to make working with this ‘extra clock’ a bit simpler.

The problem with the above method is that WindowClock isn’t a typical application—once it’s running, there’s no obvious way to quit it. It doesn’t have a menu bar, and the contextual menu doesn’t offer a quit option. That’s because Apple didn’t expect folks to be running the clock directly; it’s only designed to be launched through the Date & Time System Preferences panel. To get rid of the extra clock, you can open the Date & Time preferences panel, and then toggle the “View in” section twice (from Menu Bar to Desktop and back again), which will make the Desktop version vanish.

But with a little assist from AppleScript, there’s a much nicer way to handle the extra clock. Open Script Editor (in /Applications: AppleScript) and copy and paste the following code:

	tell application "System Events"

if (get name of processes contains "WindowClock") then
tell application "WindowClock" to quit
else
tell application "WindowClock" to run
end if
end tell

Click Compile and make sure you don’t get any error messages, then choose File: Save. Give your script a fitting name, like Toggle Clock , and set the File Format pop-up to Application. Specify a save location for the new program (such as your user’s Documents folder), and then click Save. In the Finder, navigate to the newly-created application, and double-click it. If the window clock wasn’t active before, it will now show up. If it was active, it will vanish. Run your new program again, and the opposite action will occur. To make the script even easier to use, consider putting it in your Dock, side bar, or tool bar, so that you can get to it without drilling down into your user’s Documents folder.

By using this tip, you can easily work with two clocks, and keep both in the format you prefer. For me, that’s a digital clock in the menu bar (set via the Date & Time preferences panel), and an analog clock floating above the desktop. Be aware that if you use the Date & Time panel to make any changes to your menubar clock’s settings, the floating clock will vanish. To reactivate it, of course, just double-click your new Toggle Clock application, and you’re back in business.

Shop Tech Products at Amazon