Keyboard Shortcuts

Startup:
Press X during startup – Force Mac OS X startup
Press Option-Command-Shift-Delete during startup – Bypass primary startup volume and seek a different startup volume (such as a CD or external disk)
Press C during startup – Start up from a CD that has a system folder
Press N during startup – Attempt to start up from a compatible network server (NetBoot)
Press T during startup – Start up in FireWire Target Disk mode
Press Shift during startup – Start up in Safe Boot mode and temporarily disable login items and non-essential kernel extension files (Mac OS X 10.2 and later)
Press Command-V during startup – Start up in Verbose mode.
Press Command-S during startup – Start up in Single-User mode

Finder window:
Command-W – Close Window
Option-Command-W – Close all Windows
Command-Right Arrow – Expand folder (list view)
Option-Command-Right Arrow – Expand folder and nested subfolders (list view)
Command-Left Arrow – Collapse Folder (list view)
Option-Command-Up Arrow – Open parent folder and close current window

Menu commands:
Shift-Command-Q (Apple Menu) – Log out
Shift-Option-Command-Q (Apple Menu) – Log out immediately
Shift-Command-Delete (Finder Menu) – Empty Trash
Option-Shift-Command-Delete (Finder Menu) – Empty Trash without dialog
Command-H (Finder Menu) – Hide Finder
Option-Command-H (Finder Menu) – Hide Others
Command-N (File Menu) – New Finder window
Shift-Command-N (File Menu) – New Folder
Command-O (File Menu) – Open
Command-S (File Menu) – Save
Shift-Command-S (File Menu) – Save as
Command-P (File Menu) – Print
Command-W (File Menu) – Close Window
Option-Command-W (File Menu) – Close all Windows
Command-I (File Menu) – Get Info
Option-Command-I (File Menu) – Show Attributes Inspector
Command-D (File Menu) – Duplicate
Command-L (File Menu) – Make Alias
Command-R (File Menu) – Show original
Command-T (File Menu) – Add to Favorites (Mac OS X 10.2.8 or earlier), Add to Sidebar (Mac OS X 10.3 or later—use Shift-Command-T for Add to Favorites)
Command-Delete (File Menu) – Move to Trash
Command-E (File Menu) – Eject
Command-F (File Menu) – Find
Command-Z (Edit Menu) – Undo
Command-X (Edit Menu) – Cut
Command-C (Edit Menu) – Copy
Command-V (Edit Menu) – Paste
Command-A (Edit Menu) – Select All
Command-1 (View Menu) – View as Icons
Command-2 (View Menu) – View as List
Command-3 (View Menu) – View as Columns
Command-B (View Menu) – Hide Toolbar
Command-J (View Menu) – Show View Options
Command – [ (Go Menu) – Back
Command – ] (Go Menu) – Forward
Shift-Command-C (Go Menu) – Computer
Shift-Command-H (Go Menu) – Home
Shift-Command-I (Go Menu) – iDisk
Shift-Command-A (Go Menu) – Applications
Shift-Command-F (Go Menu) – Favorites
Shift-Command-G (Go Menu) – Goto Folder
Command-K (Go Menu) – Connect to Server
Command-M (Window Menu) – Minimize Window
Option-Command-M (Window Menu) – Minimize All Windows
Command-? (Help Menu) – Open Mac Help
Command-Space – Open Spotlight (Mac OS X 10.4 or later)
Command-esc (Front Row) – Activates Front Row for certain Apple computers

 

Universal Access and VoiceOver:
Option-Command-8 – Turn on Zoom
Option-Command-+ (plus) – Zoom in
Option-Command– (minus) – Zoom out
Control-Option-Command-8 – Switch to White on Black
Control-F1 – Turn on Full Keyboard Access

When Full Keyboard Access is turned on, you can use the key combinations listed in the table below from the Finder:
Control-F2 (Full Keyboard Access) – Highlight Menu
Control-F3 (Full Keyboard Access) – Highlight Dock
Control-F4 (Full Keyboard Access) – Highlight Window (active) or next window behind it
Control-F5 (Full Keyboard Access) – Highlight Toolbar
Control-F6 (Full Keyboard Access) – Highlight Utility window (palette)
Command-F5 or fn-Command-F5 – Turn VoiceOver on or off (Mac OS X 10.4 or later)
Control-Option-F8 or fn-Control-Option-F8 – Open VoiceOver Utility (Mac OS X 10.4 or later)
Control-Option-F7 or fn-Control-option-F7 – Display VoiceOver menu (Mac OS X 10.4 or later)
Control-Option-; or fn-Control-option-; – Enable/disable VoiceOver Control-Option lock (Mac OS X 10.4 or later)

The Universal Access preference pane allows you to turn on Mouse Keys. When Mouse Keys is on, you can use the numeric keypad to move the mouse. If your computer doesn’t have a numeric keypad, use the Fn (function) key.

 

Mouse Keys:
8 – Move Up
2 – Move Down
4 – Move Left
6 – Move Right
1, 3, 7, and 9 – Move Diagonally
5 – Press Mouse Button
0 – Hold Mouse Button
. (period on keypad) – Release Mouse Button (use after pressing 0)

 

Other Commands:
Option-Command-D – Show/Hide Dock
Command-Tab – Switch application
tab – Highlight next item
Command-Up Arrow – Move up one directory
Command-Down Arrow – Move down one directory
Page Up or Control-Up Arrow – Move up one page
Page Down or Control-Down Arrow – Move down one page
Option-Drag – Copy to new location
Option-Command-Drag – Make alias in new location
Command-Drag – Move to new location without copying
Shift-Command-C – Show Colors palette in application
Command-T – Show Font palette in application
Command-Shift-3 – Take a picture of the screen
Command-Shift-4 – Take a picture of the selection
Command-Shift-4, then press Control while selecting – Take a picture of the screen, place in Clipboard
Command-Shift-4, then Spacebar – Take a picture of the selected window
Option-Command-esc – Force Quit
Control-Eject – Restart, Sleep, Shutdown dialog box
Control-Command-Eject – Quit all applications and restart
Option-Command-Eject or Option-Command-Power – Sleep
Command-click window toolbar button (upper right corner) – Cycle through available views for the window’s toolbar (dependant on the nature of the Finder or application window)
Command-` – Cycle through windows in application or Finder (if more than one window is open)
Function-Delete – (portables only–PowerBook, iBook, MacBook, MacBook Pro) Forward Delete – (delete the character to the right of your cursor)

Exposé

Become a Spaces Cadet!

Spaces, one of the coolest new features of Mac OS X Leopard, lets you switch among multiple desktops. For example, you might create a communication workspace for Mail, iChat, and Address Book, another for media programs like iTunes and iPhoto, and a third for video games.
Then, instead of hiding/showing programs or dragging them around onscreen, you’d simply switch desktops. If you’re the sort of user who tends to have many applications open at once, Spaces is a godsend.

In fact, Spaces and Expose share a control panel. To access it, select System Preferences from the Apple menu and choose Exposé & Spaces. Click the Spaces tab.

This is where you set the key commands for activating Spaces and switching between your desktops. You can also specify the number of desktops and how they’re arrayed in columns and rows. (If you check “Show Spaces in menu bar,” you can switch desktops using the menu bar icon as well as key commands.)

You also have the option of permanently assigning a program to a particular desktop. If, say, you always want iTunes to open in its own window, click the Add (+) button, navigate to the iTunes application, and click Add. Click-hold in the Spaces field to assign it to a desktop. Here, for example, whenever iTunes is opened, Space 4 will automatically be displayed.

Whenever you type your Spaces key commands, you’ll see a translucent overlay depicting the available desktops. Switch between them using the key commands you’ve assigned in the Preferences panel.

If you get confused about what’s assigned where, don’t panic — just press the Activate Spaces key command (the default assignment is F8).
This opens a global view of all your desktops. Just click within any desktop to open it.
You can also move items from one desktop to another simply by dragging them between windows.

Changing Dashboard and Exposé settings:

If you assign a Mouse button to a function in the Dashboard & Exposé pane in System Preferences but it doesn’t work as expected, go to Mouse tab of the Keyboard & Mouse pane to assign the function to the mouse button.

Since you can assign functions to your mouse buttons in the Keyboard & Mouse pane and the Dashboard & Exposé pane, you may inadvertently override a function if you give the same button a new function in the Dashboard & Exposé pane. If the button is enabled in the Mouse tab of the Keyboard & Mouse pane (not set to Off), it will use the most recent setting you assigned to it, but the other preference pane may not always show the newest function.

In other words, if a Mouse button doesn’t behave how you expect it to, go to the Mouse tab in the Keyboard & Mouse pane and reassign the function to the mouse button.


Exposé Show-Off Trick #1:

Showing off Exposé to a friend or co-worker who uses a PC is more than a blast, it’s your duty, because even Windows XP still has nothing like it. But if you really want to be a major hambone, before you press F9 to invoke Exposé, start a QuickTime movie clip, have a DVD playing, or have iTunes playing a song and click on the Visualizer (heck, have all three going at once). When you press F9, the QuickTime clip (DVD, iTunes, etc.) keeps playing even when miniaturized. It’s fun to watch their face as it changes from “Cool!” to “Why doesn’t Windows have that?”

See Your Way Clear with Exposé:

Mac OS X offers a simple way to see what’s on your desktop when you have a lot of windows open. It’s called Exposé, and here’s how you can use it.

Press the F9 key and Exposé instantly creates thumbnails of the open windows and displays them neatly on your screen. Click the window you want, and Exposé brings it to the front, switching automatically to the appropriate application.

You can press the F10 key to create thumbnails of the open windows of your current application. Or F11 to move all open windows to the side, so you can see the files on your desktop.

Using iChat

iChat AV: Audio Chatting? Drop It to the Dock:

If you’re doing an audio chat, do you even need the iChat window open? Well, if you close it, you’ll quit the chat, but if you minimize the chat window to the dock instead (press Command-M), you can continue your chat, even though the window is no longer visible. When it’s time to end your chat, just click on the minimized chat window in the dock.

iChat AV: Fixing Bad Audio Chats:

This is an old trick, but I forgot to include it in the previous edition of the this book…
so… here it is:

If you’re having an audio chat, and the audio becomes garbled or is dropping out a lot, you can have iChat try to improve the connection using this simple trick. Just click the Mute button for just a second, then unmute it by clicking it again. This causes iChat to reassess the connection and that will usually do the trick.

Create a Buddy Icon with Photo Booth:

If you’re using a Mac with a built-in iSight camera, use the built-in iSight camera to take a single snapshot of yourself, a 4-up snapshot (that’s four quick shots in a row), or a movie clip.

1. Open the Applications folder and double click on Photo Booth.
2. Choose the type of snapshot you’d like to take by clicking the appropriate button on the left just below the live video window.
3. Then pose nicely, smile, and click the Camera button.
Photo Booth places thumbnails in the drawer at the bottom of the window.

Ready to set your iChat buddy icon?

1. In the thumbnail drawer at the bottom of the window, select the photo you’d like to use.
2. Click the Buddy Picture icon.

Photo Booth copies the image, quickly opens iChat, and displays the photo in the Buddy Picture window. Use the slider to resize it if you’d like. Click Set, and you’re done.


Add a Buddy to iChat:

An extremely versatile application, iChat lets you participate in simple text chats, audio chats, or video chats with one or a group of people with Internet access and a MobileMe, AIM, Google Talk, or Jabber account. To get started, you first need to set up iChat on your system by clicking the icon for iChat in the Dock and responding to the questions in the dialogs that appear.

To add a buddy to your Buddy List in iChat:

Choose Add Buddy from the Buddies menu (or click the + sign at the bottom of the Buddy List window).
Type the name of your friend’s account name in the Account Name field and select the type of account from the pop-up menu.
Choose the group to which you’d like to add your new buddy, type your buddy’s first and last names in the appropriate fields, and click the Add button.

Using iCal

iCal: Your Powerful Personal Assistant:

When you add an event to your iCal calendar, you can do much more than simply name it and specify a date and time. Like a good personal assistant, it can remind you of upcoming events, help round up others for meetings, and even ensure that you have essential files in front of you at just the right moment.

To access iCal’s hidden superpowers, just double-click on the event’s name (or select it and type Command-i), then click the Edit button.

To invite other participants to an iCal event, just type their email addresses into the Attendees field. If you prefer, you can open iCal’s Addresses panel by typing Command-Option-a, and drag names from your contacts list. When you’ve added the desired contacts and event details, click Send, and Apple Mail will email the event request. If the event changes, you can send an update with the revised information.

There are many options here. For example, you can assign customized, color-coded categories to help keep track of work projects, personal appointments, and other commitments. You can set up recurring events via the repeat menu, which allows for custom recurrences (say, the last Tuesday of May every ten years) in addition to daily, weekly, monthly, and annual events. To create an event that continues over one or more days, click the “all-day” checkbox.

You can ask iCal to remind you of your upcoming events through a powerful alarm function, which issues one or more event reminders via pop-up messages or email. When pop-up reminders appear, you can “snooze” them for as little as one minute or as much as a week. You can even schedule the iCal alarm to automatically run a script or open a file on your computer at a specified time.

You can also attach documents, graphics, or other files to an event — pictures, maps, spreadsheets, or whatever — and include any relevant URLs. Finally, you can insert additional text into the Note field: anything from a phone number to an entire meeting agenda. (Though this field initially displays as a narrow strip, you can type or paste in as much text as you like.)

When you’re finished, click Done. All the data you added will appear next time you double-click on the event.

Subscribe to an iCal Calendar:

You can create calendars in iCal to keep track of all sorts of activities — all your meetings at work, your spouse’s meetings, after-school activities for the kids, family birthdays.

You can even use iCal to subscribe to calendars published on the Internet. Let’s say your kids’ soccer league publishes the practice and match schedules on the league’s .Mac site. To subscribe, simply:

1. In iCal, choose Calendar from the Subscribe menu.
2. Type the URL for the .Mac website where the schedule is published.
3. Check the “Refresh” checkbox to have iCal automatically update your copy of the calendar when the league publishes updates.
4. Click the Subscribe button.

And you’re done. iCal adds the schedule to your Calendars list and places a curved arrow next to it. Double-click the name if you’d like to change it, but you can’t make any other changes to a calendar you’re subscribing to.

Share an iCal Schedule:

With your busy schedule, you depend on iCal to make certain you know when the kids need to be at the dentist and when you’re supposed to be in Philadelphia for the sales conference. Since this information may be just as valuable to your spouse, it would be helpful to share your calendar, and iCal offers a simple way to do so.

Select the calendar you want to share.
From the Calendar menu, choose Publish and fill out the form in the sheet that appears.
Click Publish. iCal displays the URLs where you can view your schedule online and lets you either visit the page or send email to those with whom you’d like to share your calendar.

Address Book

See Which Groups They’re In:
If you have a contact that appears in more than one Group, you can instantly see which of your Groups this individual appears in by simply clicking on his or her contact and holding the Option key.
When you do this, every Group that they appear within will become highlighted.
This is handy if you want to clean up your Groups by deleting extra instances of people who appear in multiple Groups.

Create a Birthdays Calendar:
Thanks to Address Book, you’ll never forget a birthday again. That’s because iCal will create a Birthdays calendar for you, so you’ll have plenty of time to pick up a card or present. First you need to add a birthday field to Address Book. Here’s how:

1. Open Address Book and go to a contact to which you’d like to add a birthday.
2. Pull down the Card menu and choose Birthday from the Add Field option.

The birthdays you add in Address Book automatically appear in iCal if you:

1. Open iCal.
2. Choose Preferences from the iCal menu.
3. Click the checkbox next to Show Birthdays calendar (under the General tab).

Automatically Add Email Addresses in Mail:
When you’re reading messages in Mail, you can automatically add someone’s email address to Address Book simply by typing Command-Shift-Y. And once you create a group address in Address Book, you can add all of the group members simply by type the group name in the To (or cc) field in Mail. Here’s how:

1. Go to Address, click the + sign below the Group column, and give your new group a name — “Tennis Team,” for example.
2. Click “All” at the top of the Group column (so the name of everyone in your Address Book appears) and drag the names of everyone on the tennis team into the new Tennis Team group.
And you’re done. The next time you want to send email to the team, you won’t have to enter each name one at a time. Just start typing “Tennis Team” and let Mail fetch and fill in all the email addresses for you.

Fill Out Forms Quickly:
Enter it once. Use it practically everywhere. One of the brightest gems in Mac OS X, Address Book integrates with Safari, Mail, iChat, iCal, and other applications. And it syncs effortlessly with iPhone, iPod, and .Mac — so you can take contacts wherever you go.

Because it integrates with Safari, you can use it to fill in forms when you’re shopping online. Here’s how:

1. Open Safari and choose Preferences from the Safari menu.
2. In the Preferences dialog, click the AutoFill tab and click the checkbox next to Using info from my Address Book card.
3. Click the Edit button to view, and if you’d like, modify any of the information on your Address Book “My Card”.
Next time you shop online, Safari will retrieve the information it needs from Address Book.

Using the Dock

The One-Click Trick to Moving the Dock:

Okay, so you’re working in a program like Final Cut Pro or iMovie, which takes up every vertical inch of the screen, and when you go to adjust something near the bottom, the Dock keeps popping up.
Oh sure, you could move the Dock to where it’s anchored on the left or right side of the screen, but that just feels weird.
But what if you could move it temporarily to the left or right, and then get it back to the bottom when you close Final Cut Pro, in just one click?

Here’s how: Hold the shift key, click directly on the Dock’s divider line (on the far right side of the Dock), and drag the Dock to the left or right side of your screen. Bam! It moves over to the side.
Then, once you quit Final Cut Pro, just shift-click on that divider line and slam it back to the bottom (okay, drag it back to the bottom). A draggable Dock — is that cool or what!

Open a Web Page from the Dock:

You can fill your Dock with applications, documents, folders, and stacks. In fact, you can even add bookmarks for web pages to your Dock. Let’s say you like to keep track of the latest news about Apple. If you add the Hot News site to your Dock, you can visit it whenever you’d like with a single click. Here’s how:

1. Go to the Apple Hot News page.
2. Drag the little Apple icon just to the left of the URL in the Address bar to your Dock.

Mac OS X creates a locator icon with the name of your website. To visit the site, just click the icon. Safari launches and takes you immediately to Hot News.

Want to add another? Since you like learning more about the Mac, let’s add the Find Out How page to your Dock, as well. To do so,

1. Visit Find Out How.
2. Drag the little Apple icon just to the left of the URL in the Address bar to your Dock.

Now, when you want to learn more about using your Mac, you can Find Out How right from the Dock.

Keep an Eye on Things, Live From the Dock:

Do you like to know what’s going on “under the hood” of your Mac (stuff like your CPU usage, disk activity, memory usage — you know, total geek stuff)?
If you do, you can keep an eye on things right from within the dock using Mac OS X’s Activity Monitor. It’s found in the Applications folder, under Utilities.
Once you’ve found it, drag it into your dock, then click on it to launch it.
Once it’s launched, click-and-hold for a moment on its dock icon.
A menu will pop up, and you’ll see a dock icon menu item.
This is where you choose which activity you want to monitor from its live dock icon.
Choose it, and a live graph will appear in the dock that’s updated dynamically as you work.

Folders to Add to Your Dock:

Adding folders to the right side of your dock can be a real timesaver, and two of the most popular folders to add to the dock are your home folder and your Applications folder.
Another thing you might consider, rather than putting your entire Applications folder on your dock, is to create a new folder and put in aliases of just the applications and system add-ons (such as the Calculator, etc.) that you really use.
Then you can access these by Control-clicking on the folder in the dock and a pop-up menu will appear that looks a lot like the Apple menu from OS 9.

Dropping Text on the Dock for Fast Results:

Let’s say you’re reading an article online, and you read a sentence that you want to email to a friend. Don’t do the copy-and-paste thing. Instead, just highlight the text and drag-and-drop it right on the Mail icon in the Dock. It will open Mail and put that sentence into a new mail message. This tip also works in other Cocoa applications like TextEdit, Stickies, and Safari. For example, if you’re reading a story and want to do a Google search on something you’ve read, just highlight the text and drag-and-drop it on the Safari icon in the Dock. It will launch Safari and display the Google Search Results.

Remove an Application from the Dock:

If you’d like to reduce the number of applications from the Dock, you can do so at any time. Simply grab the icon of the document, folder, or application you’d like to remove, and drag it out of the Dock. Release the mouse button, and the item will vanish in a puff of virtual smoke.

Add an Application to the Dock:

If you enjoy the convenience of the Dock, you can make it even more useful by adding items to it you use regularly. Here, for example, you’ll find two ways to add one or more applications to your Dock.

Let’s say you’re currently using Keynote ’08, your favorite presentation software, and would like to keep it in the Dock at all times. Right-click on its icon in the Dock, and select Keep in Dock from the contextual menu that appears.

Or try this option. Open the Applications folder, grab Text Edit, and drag it to the Dock. Next time you want to use Text Edit, just click its icon in the Dock.

You can use this method to add multiple applications just as easily. In that open Applications folder, choose Calculator and Dictionary, two handy utilities, and drag both into the Dock.

Change the Position of the Dock:

Mac OS X lets you customize the Dock in a number of ways.

If you choose Dock from the Apple menu and select Dock Preferences, a dialog will open giving you access to all of the Dock customization options.

Use them to:

– change the size of the Dock
– turn Magnification On (or Off) by clicking the check box and, if On, the degree of Magnification
– indicate where you’d like the Dock to appear
– select the effect (Genie or Scale) used to minimize a window
– check the Animate box, which makes the icon for an application bounce when you open it
– check the box to have Mac OS X hide the Dock when it’s not being used

Changing the Dock Syle:

Lets get started!

Before we start, you’re going to need to design your dock style.
Now I have no tutorial made on how to do this, but this is my favorite website for dock images:

http://leoparddocks.com/

From here you can download the images you need to replace the images on your dock!

Lets Begin!

You want to go to your Mac’s HD, mine is called Tom HD.
In there you will find a folder called System that looks like this:
Once inside you’ll find a folder on its own called Library, open up the folder.

Now you will need to find a folder called “Core Services” which looks like this:

Now, look for Dock !
Once you have found it, CMD + Click it and select:
Show Package Contents – > Contents – > Resources.

You are looking for these files:
scurve-l.png – scurve-m.png – scurve-sm.png – scurve-xl.png

Select these files and make sure YOU HAVE BACKED THEM UP!

Also, in some cases you may need to back up seperator.png too.
To be on the safe side, I back it up anyway!

You’re nearly there now!

Go ahead and open the ZIP file you have downloaded from Leopard Docks (http://leoparddocks.com/), notice you have: scurve-l.png – scurve-m.png – scurve-sm.png – scurve-xl.png

You need to select those files (And sometimes, if it comes with it, the seperator.png too!)

Once you have them selected, go ahead and drag them into the Resources folder and overwrite the existing scurve PNG Files!

You’re done!

All you need to do, is restart the dock. to do this, open up Terminal
(CMD + Space – > Type Terminal – > Press Enter)

Once you’re in terminal, type:
killall Dock

Once the dock has reloaded, you should have a sweet new dock !

Customizing Your Mac

Customize Your Mighty Mouse:

Whether you’re using a wired or wireless Mighty Mouse, you can customize it easily:

1. Choose System Preferences from the Apple menu.
2. Click Keyboard & Mouse; then click the Mouse tab.
You can program the four buttons on your Mighty Mouse, set scrolling options, and set response sensitivities for tracking, scrolling, and double-clicking.

Customize Your Mac with a Screen Saver:

Screen savers offer a great way to customize — and enjoy — your Mac. You have a variety of screen savers to choose from:

1. Choose System Preferences from the Apple menu.
2. Click Desktop & Screen Saver; then click the Screen Saver tab.
The column on the left lists the possibilities. You can also tell Mac OS X to generate a screen saver automatically based on the album art in your iTunes library or the photos in your iPhoto or Aperture photo libraries.

Simply click any of the available options to choose a screen saver. You can try it by clicking Test below the Preview screen.

Quickly Activate Your Screen Saver:

By designating a Hot Corner, you can have your screen saver start whenever you move the mouse into that corner. Here’s how:

1. Choose System Preferences from the Apple menu.
2. Click Desktop & Screen Saver and click the Screen Saver tab.
3. Choose one Screen Saver option and click the Hot Corners button.
4. Use the pull-down menus to indicate the corner you’d like to use to activate your screen saver.

Open Applications Automatically on Startup:

If you frequently listen to music, surf the web, get your email, or chat with friends, you may want your computer to open those applications every time you start up. On a Mac, it’s simple to do. Select System Preferences from the Apple menu, then:

1. Click Accounts (in the System row of the System Preferences window).
2. Click the Login Items tab.
3.Click the Add (+) button.
4. Scroll down and click Applications
5. Select iTunes and click the Add button.

The next time you start up your Mac, iTunes will start up, too. In addition to opening applications at Start Up, you can have Mac OS X open documents.

Quickly Switch Between Applications:

The Mac makes it easy to have multiple applications — Mail, Safari, iTunes, Pages, iChat, iPhoto, and others — open at the same time. So how do you quickly switch from Safari, let’s say, to Mail?

Just hold down the Command key and press the Tab key (Command-Tab). Mac OS X immediately displays a mini-Dock with icons for each of your open applications. At the left side of the mini-Dock, you’ll see the icon for your current application. Next to it (and highlighted), you’ll find the icon for the application you last used. Each time you press the Tab key (without releasing the Command key), you can cycle through your open applications.

One more tip: You can also use the Left Arrow and Right Arrow keys to navigate your open applications.

Get Dictionary Definitions in One Click:

You’re using Safari to research a paper on climate change and you find the phrase “anthropogenic greenhouse gas concentrations.” What exactly does “anthropogenic” mean?

Here’s a fast way to get the definition of a word you’re not familiar with.

1. Hover your Mighty Mouse over the word and right-click.
2. Choose Look Up in Dictionary from the menu that appears.
3. Mac OS X immediately opens Dictionary and finds the meaning of “anthropogenic” for you.

Stored in the Applications folder, Dictionary works with all Mac OS X applications.

Go Home:

Whether you share a Mac with others or have one all to yourself, you can find all your personal data — documents, downloads, music, and more — in the home folder Mac OS X created for you when you set up your Mac (or when someone created an account for you).

You can spot your home folder easily: It’s the one with the icon of a house and your account name. And if you place it in the Dock, you can open it quickly without having to open any folders. Here’s how:

1. In the Finder, click the icon for your hard drive. (Unless you’ve renamed it, it’s probably called Macintosh HD.)
2. Open the Users folder.
3. Then drag your home folder from the Users folder into the Dock and release the mouse button.

Now, whenever you need anything in your home folder, you can access it quickly from the Dock.

 

Back Up Your Music, Photos, and Documents:

Time Machine is the fabulous backup application that’s part of Mac OS X Leopard. To use Time Machine, simply connect an external hard drive to your computer. The first time you connect it to your Mac, Leopard displays a dialog asking if you’d like to use it as your backup location. If the dialog doesn’t appear, don’t worry:

1. Choose System Preferences from the Apple menu.
2. Click the Time Machine icon.
3. Click Choose Backup Disk.

Time Machine toggles on, changes the image for your backup disk, and indicates when the next (in this case, the first) backup will occur). For best results, you should use a drive that’s at least as large as your Mac startup drive. (If your internal hard drive can hold up to 250GB of data, your Time Machine volume should hold at least 250GB.) And it’s a good idea not to store any other data on your Time Machine drive. That way, you maximize the amount of space you have to backup your files.


Take a Quick Look
:

How do you quickly find a photo without opening them one at a time?

Let Quick Look help you. A new feature in Leopard, Quick Look lets you browse files — photos, Pages documents, Keynote presentations, QuickTime movies, Microsoft Word and Excel files — without having to open an application. Here’s how:

In the Finder, open the folder that contains the item you hope to find.
Select a photo; then click the Quick Look button in the folder’s toolbar (or press Command-Y).
Leopard instantly opens a Quick Look window with the photo you selected.

Not the photo you were looking for? Just click another. Quick Look keeps the preview window open, letting you click photos until you find the one you want.


Capture Screen Shots
:

In Mac OS X, you can use simple keyboard shortcuts to do all sorts of things, including capturing images of what’s on your Mac screen. For example, you can take a screen shot of your entire screen by holding down the Command and Shift keys and pressing a 3.

If you hold down the Command and Shift keys and press 4, Mac OS X turns the cursor into crosshairs you can use to select whatever portion of your display you’d like to capture in a screen shot.

If you immediately hit the Spacebar after typing Command-Shift-4, Mac OS X replaces those crosshairs with a little a camera. Using the camera, you can take a screen shot of the Dock, the entire menu bar, a single open menu, the desktop, or any open window.

Make Symbols on a Mac

Method One

Hold down the Option key

On a Macintosh, “Option” is the same as “Alt” on a Windows computer.

The list on the left shows symbols you can type by holding down Option plus another key. The list at right requires you to press Option, Shift and a third key.

 

Symbols With the “Option / ALT” Key Pressed

      Option and ` = dead key of grave accent: follow with aeiou to get àèìòù
      Option and 1 = ¡
      Option and 2 = ™
      Option and 3 = £
      Option and 4 = ¢
      Option and 5 = ∞
      Option and 6 = §
      Option and 7 = ¶
      Option and 8 = •
      Option and 9 = ª
      Option and 0 = º
      Option and – = –
      Option and = = ≠
      Option and q = œ
      Option and w = ∑
      Option and e = ´
      Option and r = ®
      Option and t = †
      Option and y = ¥
      Option and u = ¨
      Option and i = ˆ
      Option and o = ø
      Option and p = π
      Option and [ = “
      Option and ] = ‘
      Option and = «
      Option and a = å
      Option and s = ß
      Option and d = ∂
      Option and f = ƒ
      Option and g = ©
      Option and h = ˙
      Option and j = ∆
      Option and k = ˚
      Option and l = ¬
      Option and ; = …
      Option and ‘ = æ
      Option and z = Ω
      Option and x = ≈
      Option and c = ç
      Option and v = √
      Option and b = ∫
      Option and n = ˜
      Option and m = µ
      Option and , = ≤
      Option and . = ≥
      Option and / = ÷
Symbols With the “Option / ALT” and “Shift” Keys Pressed

      Option, Shift, and ` = `
      Option, Shift, and 1 = ⁄
      Option, Shift, and 2 = €
      Option, Shift, and 3 = ‹
      Option, Shift, and 4 = ›
      Option, Shift, and 5 = fi
      Option, Shift, and 6 = fl
      Option, Shift, and 7 = ‡
      Option, Shift, and 8 = °
      Option, Shift, and 9 = ·
      Option, Shift, and 0 = ‚
      Option, Shift, and – = —
      Option, Shift, and = = ±
      Option, Shift, and q = Œ
      Option, Shift, and w = “
      Option, Shift, and e = ´
      Option, Shift, and r = ‰
      Option, Shift, and t = ˇ
      Option, Shift, and y = Á
      Option, Shift, and u = ¨
      Option, Shift, and i = ˆ
      Option, Shift, and o = Ø
      Option, Shift, and p = ∏
      Option, Shift, and [ = “
      Option, Shift, and ] = ‘
      Option, Shift, and = »
      Option, Shift, and a = Å
      Option, Shift, and s = Í
      Option, Shift, and d = Î
      Option, Shift, and f = Ï
      Option, Shift, and g = ˝
      Option, Shift, and h = Ó
      Option, Shift, and j = Ô
      Option, Shift, and k = 
      Option, Shift, and l = Ò
      Option, Shift, and ; = Ú
      Option, Shift, and ‘ = Æ
      Option, Shift, and z = ¸
      Option, Shift, and x = ˛
      Option, Shift, and c = Ç
      Option, Shift, and v = ◊
      Option, Shift, and b = ı
      Option, Shift, and n = ˜
      Option, Shift, and m = Â
      Option, Shift, and , = ¯
      Option, Shift, and . = ˘
      Option, Shift, and / = ¿
      Option, Shift, and < =¯
      Option, Shift, and > =˘

 

Method Two

Go to System Preferences

 

Select International.

That is the fourth (fifth, in 10.5 (Leopard)) icon over in the row marked Personal.

 

When you get to the International page, select the tab that says Input Menu.

 

Look for Character Palette in the menu that appears.

When you find it, click the checkbox next to it, but do not un-check the box next to your native language.

 

Quit System Preferences.

 

To use the character palette, open a text document (AppleWorks, TextEdit, or even your email account in an Internet browser).

 

Look for a new icon in the menu bar at the top.

It should be the last one in the row, and will look like the icon you saw next to Character Palette in System Preferences.

 

When you are ready to insert a symbol, click on the icon, and choose Show Character Palette.

 

Select a category from the menu on the left.

 

From the list on the right, click on a symbol, and then click Insert

 

Close the Character Palette.

When you’re done adding symbols, click the little red button in the upper left corner of the Character Palette.

Dashboard Development

The main face of your widget is the front side (your widget displays preferences on its back). This is the side users recognize and interact with the most.Follow these guidelines as you design your widget’s front side:

  • The design of your widget should focus on immediately conveying its primary purpose.
  • Make effective use of space. Strive to clearly show only useful information.
  • Display your information immediately. Dashboard is shown and hidden quickly, so forcing the user to wait for content to display can be annoying and time-consuming.
  • Design your widget to have a discrete functionality. It should require no explanation or configuration. Instead of creating a widget that does three things, try creating three widgets that do one thing each. This makes each task discrete and lets your users choose what is useful for them.
  • Design widgets for small screens. Your design should be a good citizen and leave room for other widgets. Users have multiple widgets open at once, so you shouldn’t monopolize screen space. Otherwise, your widget may not be used because of an impractical size.
  • Use scroll bars sparingly. The default set of information your widget displays should be minimal and should not required scrolling. If, however, the widget’s function is to provide a lot of information (e.g. a dictionary), using a scroll bar may be prudent to make the widget smaller overall. Consider offering a preference for a simple view that doesn’t require a scroll bar.
  • Use color to distinguish your widget. A unique color scheme ensures that when users want to use your widget, it’s quickly recognized.
  • Avoid garish color schemes. Contrasting colors can be offensive to users. Instead of mixing red, green, and purple in an interface, try out shades of the same color. Sometimes using various distinct colors may be appropriate, but most of the time, keeping your colors in one color space makes the widget more pleasing to the eye.
  • Use clear, readable fonts. Users expect to obtain information quickly from widgets. Avoid sacrificing readability to achieve a particular appearance. Instead, focus on building the widget’s personality into its contours and controls. Try using bold san serif fonts, like Helvetica Neue, for labels and controls.
  • Avoid using Aqua controls on your main interface. Aqua controls should only be used for the back side of your widget. Instead, design custom controls for your widget’s main interface. Ensure that controls look and behave like the objects they’re representing. A checkbox should look like a checkbox and buttons should look clickable even though they aren’t specifically Aqua controls. (To learn how to integrate a menu into your design, read “Integrated Menus.”)
  • Avoid advertising on the face of your widget. Branding your widget is acceptable and important, but advertising takes away valuable space in your widget. Presence on a user’s Dashboard is a privilege. Use the back of the widget for information that isn’t vital to the widget’s purpose, such as branding, licensing information, and copyright notices.
  • Use the CloseBoxInsetX and CloseBoxInsetY Info.plist keys to place your widget’s close box over the top left of your widget’s artwork. Since many widgets have transparency around their edges, the default location of the close box may seem to be floating off to the side of the widget. It should be moved so that it’s located over the widget. This shows the relation between the close box and the widget.
  • Support pasteboard operations whenever possible. Many users expect to be able to copy and paste elements between applications and expect the same of widgets.
  • Support drag-and-drop where appropriate. Users may expect to drop files or other dragged items on your widget.
  • Use standard graphics and controls whenever possible. Some standard controls are provided in/System/Library/WidgetResources/:

Widget Back Side Design Guidelines

If your widget requires configuration, you can display preferences on the back of your widget. Here are some tips for designing your widget’s back:

  • Use the info button graphic to signify that you are using the back of your widget for preferences or information. The info button consists of an “i” with a circle that appears when the cursor is over it. Clicking the info button triggers the flip animation. The info button is a standard used across all widgets, so users immediately know what it stands for and what happens when it’s clicked.
  • Place the info button in the bottom-right corner of your widget whenever possible. It’s OK to place it in other corners, but the bottom-right corner is where most users expect to find this button.
  • Use the flip animation only to show your widget’s back. The back side is for showing preferences or important information that may interest your users. Overusing the animation makes your widget appear unprofessional.
  • Use Aqua elements when displaying preferences. Small-sized versions of Aqua-styled controls are preferred. Unlike your main interface, your preferences should use standard Aqua controls. Here they provide a standard appearance and behaviors familiar to users, traits that are valuable since users won’t be dealing with them often and should be able to use them right away.
  • Provide a Done button. When the user has finished setting the preferences, clicking the Done button should flip the widget back to its front side. Use the button graphics available in /System/Library/WidgetResources/ for any buttons on the back of your widget.
  • Use a darker or subdued background color for your widget’s back. Reusing the background color from your main interface is not advised because it leads to confusion about which side is the main interface.
  • If necessary, show licensing information, logos, and minimal help information on the back of your widget. As you did with the main interface, avoid placing advertising here.
  • Use standard graphics and controls, as found in /System/Library/WidgetResources/, whenever possible.

Widget Bar Icons

Widgets are represented by an icon in the widget bar. The dimensions below define the standard icon size and shadow for a widget bar icon:

  • Body: 75 pixels by 75 pixels

Drop shadow:

  • 50% opacity
  • 90 degree angle from horizontal
  • 3 pixel offset (distance from source)
  • 3 pixel size, using Gaussian blur

Other Tips

Follow these tips when designing and implementing your widget.

Widget Programming

  • Use JavaScript whenever possible. Animation and widget logic is possible using JavaScript and results in faster execution and a smaller memory footprint.
  • Use custom Widget and WebKit plug-ins sparingly. Plug-ins add significant complexity to your widget and should only be used whenever a task isn’t possible using JavaScript.
  • Avoid using Java applets, Flash animations, and QuickTime movies. They are heavyweight and take up a considerable amount of memory.

Drop Shadows

Widget backgrounds tend to feature drop shadows. The dimensions below define the standard drop shadow for a widget:

  • 50% opacity
  • 90 degree angle from horizontal
  • 4 pixel offset (distance from source)
  • 10 pixel size, using Gaussian blur

Integrated Menus

As previously noted, you should design unique, custom controls that integrate well into your widget’s overall design instead of using standard Aqua controls. Displaying a menu in this context is common and features an implementation that is a little unusual but not difficult to make work.

First, you need to design a custom control that resembles a popup menu, like the Voices sample code does.

Note the characteristics shared between an Aqua popup menu and the custom control used here: the arrow icons, the left aligned text, and a defining outline that specifies the bounds of the control. Also, note the differing color versus the widget’s background. These are all things to take into account when making your own custom menu control.

Three elements, one of which is unseen here, make this menu work: an image that represents the popup menu, a line of text that shows the current menu option, and, unseen here, a hidden <select> popup menu element that provides the actual menu used to select an option.

Implementing Your Custom Menu Control

After designing your popup menu, you need to set up three elements in HTML: the popup image you designed, a text element that reflects the currently selected menu option, and a <select> element that holds your actual menu:

<img src="Images/Menu.png" />
<div id="popupMenuText">Available Voices</div>
<select id='popupMenu' onchange='popupChanged(this);'>
        <option value="One">One</option>
        <option value="Two">Two</option>
</select>

Now that the elements are in place, position them using CSS. The menu image is placed first, with the text over it. The linchpin is the <select> element, which provides the menu when clicked; it’s placed over the text and image, but its opacity is set to zero.

.popupMenuImage {
    position: absolute;
    left: 28px;
    top: 169px;
    z-index: 18;
}
#popupMenuText {
    font: 13px "Helvetica Neue";
    font-weight: Bold;
    color: white;
    text-shadow: black 0px 1px 0px;
    position: absolute;
    left: 44px;
    top: 176px;
    z-index: 19;
}
#popupMenu {
    position:absolute;
    top: 169px;
    left: 28px;
    width: 163px;
    height: 30px;
    opacity: 0.0;
    z-index: 20;
}

Doing this makes your custom image look like the control being clicked, but in reality, the <select> receives the click and displays its menu. Rest assured that while the popup menu itself is transparent, the menu shown is opaque.

The final piece is changing the custom popup menu text when a user chooses an option in the menu. In the HTML, a function is set that’s called when the popup’s selection changes. This function changes the menu text to reflect the new selection:

function popupChanged(elem)
{
    var chosenOption = elem.options[elem.selectedIndex].value;
    document.getElementById("popupMenuText").innerText = chosenOption;
    // Other code that handles the menu selection change
}

Search Fields

Many widgets feature a search field that allows users to find content that your widget displays. WebKit offers a new type of <input>type, called search that provides the look and behavior of a standard search field for a widget:

<input type="search">

In addition to the search type of the <input> element, these attributes are available when this type is used:

placeholder

Allows you to specify placeholder text for the search field; this text is shown inside the field when it does not have key focus and should be a label indication what type of input it expects.

results

Allows you to specify how many results are saved. Saved search terms are displayed in a menu that’s displayed when the search field’s magnifying glass is clicked upon.

onsearch

Allows you to specify a handler that is called when the enter or return keys are pressed.

incremental

Including this attribute means that the onsearch handler is called every time a character is entered into the search field.

onkeypress

Allows you to specify a handler that is called when any key is pressed.

Help Tags

Many applications feature help tags that appear to users as they hold their cursor over an element. Your widget should display help tags for controls and any other elements that would benefit from further explanation. To provide a help tag for an element, use the titleattribute:

<div id="helloText" title="This is a helpful explanation of this element">Hello, World!</div>

Universal Access

VoiceOver is a system-wide screen reader that benefits visually impaired users by audibly describing the current window.

To ensure that VoiceOver properly describes your widget, you need to take two things into account when creating it:

  • In your HTML, structure your elements logically. If your widget has a top-down orientation, make sure the corresponding HTML elements are in an order that reflects their orientation. Likewise, if your widget displays its information from the left to the right, make sure that the left-most element is the first in your HTML and that each subsequent section follows in the file’s structure.
  • Use alt attributes to describe images. VoiceOver reads these aloud when it comes to an image in your widget:
<img src="sun.png" alt="Sunny">

Dashboard Environment

Dashboard widgets provide an easy way for people to access important information and perform simple tasks without disturbing their work on the desktop. The Dashboard application, available in OS X v10.4 and later, provides the environment widgets run in and allows users to manage their widgets. This article introduces the Dashboard environment and explains how to create a simple widget.
Users show Dashboard by using a key stroke, as specified in the Exposé & Spaces pane of System Preferences. By default, the key is F12. Alternatively, users can click the Dashboard icon in the Dock. When Dashboard runs, it overlays the windows currently visible on the desktop and displays the active widgets

Multiple widgets, including multiple instances of one widget, can exist in Dashboard at one time. Users have complete control over what widgets are visible and can freely move them anywhere they please in Dashboard. The widgets appear when Dashboard is launched and disappear when Dashboard is dismissed.

Dashboard also provides ways for users to manage their widgets. Clicking the button in the lower-left corner of Dashboard displays:

  • The set of enabled widgets in the widget bar across the bottom of the screen, as shown in Figure 1. (Enabled widgets are those that are installed and ready to place in Dashboard.)
  • The Manage Widgets button and the Widgets widget, both of which open a list of all installed widgets and give users an easy way to download more widgets.
  • A close button at the upper-left of each widget in Dashboard (shown in Figure 1), which allows users to remove the widget from Dashboard without deleting it.

What Is a Dashboard Widget?

A widget is a mini application that exists exclusively in Dashboard. From the user’s perspective, it behaves as an application should: it shows useful information or helps them perform a simple task with a minimum of input. For example, Weather displays a 6 day weather forecast for the location the user selects.

Despite the fact that widgets look like applications to the user, widgets are powered by web technologies and standards such as HTML, CSS, and JavaScript. In addition to web technology, Apple provides useful additions such as preferences, localization, and system access.

Above all, widgets are small, lightweight, and narrowly focused on a single task. Users reveal Dashboard when they want to check on something or perform a quick, simple task while they are in the midst of using their desktop applications. For this reason, users expect widgets to be instantly available, quick to use, and easy to dismiss.

Creating a Simple Widget

To develop a widget you must work with the bundle structure, a property list, and some combination of HTML, CSS, and JavaScript. This section describes these components and helps you create a simple Hello World widget.

As you create this widget, you become familiar with a widget’s bundle structure, its information property list file, a basic style sheet, and the HTML file needed to make the widget function. You also learn how to put these pieces together and install the widget in the right place.

All of the files needed to implement this widget are available in the Hello World sample project.

Widget Bundle Structure

Widgets are distributed as bundles. A bundle is a directory in the file system that groups related resources together in one place. A widget’s bundle contains at least four files: an information property list file (Info.plist), an HTML file, and two PNG images. There may or may not be a fifth file that contains the style sheet for the widget.

For the Hello World widget, the bundle structure contains the following files:

Hello World.wdgt/
Icon.png
Info.plist
Default.png
HelloWorld.html
HelloWorld.css

HTML, CSS, and JavaScript Files

The HTML, CSS, and JavaScript files provide the implementation of the widget. In these files, you can use any technique or trick that you would use when designing a webpage. This includes, but is not limited to, HTML, CSS, and JavaScript. In general, you use HTML to define the structure of your widget, CSS to provide the visual style, and JavaScript to support interactivity.

Although you can place all of your HTML, CSS, and JavaScript code into one file, you may find it more manageable to split these into separate files, as shown in Table 1. Splitting your markup, design, and logic into separate files may also make localization easier, as discussed in “Localizing Widgets.” The file extensions listed in Table 1 are used to reflect the purpose of the file:

Table 1  File extension mappings for web technologies
Technology Purpose File extension Example
HTML Structure .html HelloWorld.html
CSS Design .css HelloWorld.css
JavaScript Logic .js HelloWorld.js

These file extensions are not enforced by Dashboard, but it is recommended that you adhere to these standards.

It is advisable to create a single HTML file for your widget. If a widget contains more than one HTML file, the resulting reloads can make your widget seem less like a mini application and more like a website.

To load your CSS and JavaScript, you need to import them inside of your HTML file. To import a style sheet (in other words, a CSS file), you add HTML code that looks similar to this:

<style type="text/css">
    @import "HelloWorld.css";
</style>

To load a JavaScript file, use the <script> tag:

<script type='text/javascript' src='HelloWorld.js'></script>

Note that if your widget does not use CSS or JavaScript, there is no need to use these includes or to include blank CSS or JavaScript files. Conversely, you can use multiple @import statements and <script> tags to include more than one CSS or JavaScript file.

Widget Property Lists

Each widget must have an information property list (Info.plist) file associated with it. This file provides Dashboard with information about your widget. Dashboard uses this information to set up a space in which it can operate.

The Info.plist file contains the needed information. In a basic widget’s Info.plist file are five mandatory keys and four optional keys. These keys are listed in Table 2 along with their definitions and some example values used in the Hello World widget:

Table 2  Widget Info.plist properties
Key Example value Definition
CFBundleIdentifier com.apple.widget.HelloWorld Required. A string that uniquely identifies the widget, in reverse domain format.
CFBundleName Hello World Required. A string that contains the name of your widget. Must match the name of the widget bundle on disk, minus the .wdgt file extension.
CFBundleDisplayName Hello World Required. A string that contains the actual name of the widget, to be displayed in the widget bar and the Finder.
CFBundleVersion 1.0 Required. A string that gives the version number of the widget.
CloseBoxInsetX 16 Optional. An integer between 0 and 100 that sets the placement of the widget’s close box on the x-axis.
CloseBoxInsetY 14 Optional. An integer between 0 and 100 that sets the placement of the widget’s close box on the y-axis.
Height 126 Optional. A number that gives the height, in pixels, of your widget. If not specified, the height of Default.png is used.
MainHTML HelloWorld.html Required. A string that gives the name of the HTML file that implements your widget.
Width 235 Optional. A number that gives the width, in pixels, of your widget. If not specified, the width of Default.png is used.

Of note are the values for the CloseBoxInsetX and CloseBoxInsetY keys. These values determine the placement of the close box of your widget. You should position the close box so that the “X” is centered over the top-left corner of the widget.

The complete information property list file for the Hello World sample widget looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>CFBundleDisplayName</key>
    <string>Hello World</string>
    <key>CFBundleIdentifier</key>
    <string>com.apple.widget.helloworld</string>
    <key>CFBundleName</key>
    <string>Hello World</string>
    <key>CFBundleShortVersionString</key>
    <string>1.0</string>
    <key>CFBundleVersion</key>
    <string>1.0</string>
    <key>CloseBoxInsetX</key>
    <integer>16</integer>
    <key>CloseBoxInsetY</key>
    <integer>14</integer>
    <key>MainHTML</key>
    <string>HelloWorld.html</string>
</dict>
</plist>

Note that in this Info.plist file, the Width and Height keys are omitted. As previously mentioned, these keys are optional. Because they aren’t included, this widget is automatically sized based on the dimensions of its default image.

There are more optional Info.plist keys than those described here; you can read about them in “Dashboard Info.plist Keys”. Of particular note are the access keys, which allow you to turn on access to external resources. “Using Access Keys” discusses these in more depth.

Icons and Default Images

The two image files required in a widget are the icon and default image files. They need to be formatted as Portable Network Graphics (PNG) files and must be named Icon.png and Default.png, respectively.

The icon file, Icon.png, is used in the widget bar as a representation of your widget:

The default image, Default.png, is shown while your widget loads. It can be the background used by your widget or any other appropriate image. This file also sets the size of your widget if you don’t use the Height and Width properties in your Info.plist file.

For more on widget bar icon sizes and other design elements, see “Designing Widgets.”

Implement the Widget

Your widget’s HTML file provides the implementation of the widget. You can name it anything you like, but it must reside at the root level of the widget bundle and must be specified in the Info.plist file. For the Hello World sample widget, the HTML file displays an image and the words “Hello, World!” The contents of the HelloWorld.html file is shown in Listing 1:

Listing 1  The Hello World HTML file

<html>
<head>
<style>
@import “HelloWorld.css”;
</style>
</head>
<body>
<img src=”Default.png” />
<span>Hello, World!</span>
</body>
</html>

The HTML for this widget specifies the image used as the background and the text to display. Notice, however, that the above HTML file doesn’t contain any style information. Instead, it imports another file that has this information: HelloWorld.css. As discussed in “HTML, CSS, and JavaScript Files,” you don’t have to break your CSS and JavaScript out of the HTML file, but it is recommended. The fileHelloWorld.css contains all of the style information for the widget, as shown in Listing 2:

Listing 2  The Hello World CSS file

body {
margin: 0;
}
.helloText {
font: 26px “Lucida Grande”;
font-weight: bold;
color: white;
position: absolute;
top: 41px;
left: 32px;
}

The style sheet defines the styles for the body and for an arbitrary span class called helloText. This class is applied to the “Hello, World!” text in the HelloWorld.html file.

 

In fact, when testing your widget, you can open it in Safari and get the same appearance you would get if it were loaded into Dashboard.

Assemble and Load the Widget

Now that you have completed the three basic components for the widget, you can assemble them into a bundle and load your widget into Dashboard.

First, create a new directory named Hello World. Then, place these files in it at the root level:

  • Default.png
  • HelloWorld.html
  • HelloWorld.css
  • Icon.png
  • Info.plist

When the files are in place, rename the directory Hello World.wdgt.

After the bundle has been renamed, double click its icon in the Finder to install it. This displays an install dialog that, when you click Install, copies the widget to ~/Library/Widgets/ and opens it in Dashboard.

Congratulations! You’ve just created your first Dashboard widget.

Now you’re ready to enhance your widget with some of the features Apple provides in Dashboard and WebKit. Begin by reading about the guidelines that govern great widgets in “Designing Widgets.”

Then, read other articles in this document to learn about details that interest you, such as “Using Animation” .