Create shortcuts for self-modifying menu items

Many programs use their menus to enable or disable a given feature—for instance, Mail has the View -> Organize by Thread option. There are a couple of different ways to show the status of such menu item toggles. In the specific example of Mail’s Organize by Thread option, Mail adds a check mark in front of Organize by Thread when you enable that view mode.

A more recent trend, though, is menu items whose names actually change when the chosen feature is enabled. In the Finder, for instance, the View menu contains Show Path Bar and (depending on your chosen view) Show Status Bar. Select either one, and the menus themselves switch to Hide Path Bar or Hide Status Bar. The advantage of this approach over the check mark is that it’s perfectly clear what happens when you select that menu item. The apparent disadvantage—and one I ran into myself—comes in trying to assign those menu items to a keyboard shortcut.

In my case, I wanted a quick way to disable iChat’s smileys, via the View -> Messages -> Hide Smileys menu option. (I need to disable them because when I receive code snippets, there are quite a few instances where common code combinations (ie =$) turns into a smiley of some sort (the “money mouth” smiley for =$). Assigning Control-S (or whatever you like) to Hide Smileys is simple enough—just pop over to the Keyboard tab of the Keyboard and Mouse System Preferences panel. Click the plus sign, set the Application pop-up to iChat, enter Hide Smileys for the Menu Title, enter your desired keystrokes in the Keyboard Shortcuts box, then click Add.

But that only solves half the problem—how do you assign the same keyboard shortcut for two different menu items—Show Smileys, in this example? It turns out the Mac OS is really smart (or really dumb?) about this, as it doesn’t care if you assign the same keyboard shortcut to more than one menu item! So after adding the first shortcut, click Add again and repeat the process, but change the Menu Title to Show Smileys. Assign it the same Control-S shortcut and click Add, and when you’re done, you should see something like this:

image

  • Finder: View menu, Show/Hide Path Bar and Show/Hide Status Bar
  • Mail: View menu, Display Selected Messages Only/Display All Messages and Show/Hide Toolbar
  • TextEdit: Format menu, Allow/Prevent Editing
  • iCal: A slew of entries in the View menu, including Show/Hide for the calendar list, mini months, notifications, and search results.

I’m sure there are a lot of other apps that have similar menus. If you prefer the keyboard to the mouse, keep this little trick in mind to turn assign keyboard-based toggles for these self-modifying menu items.

  
Shop Tech Products at Amazon