O'Reilly logo

Modding Mac OS X by Erica Sadun

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Adding an Item to the Contextual Menu

In the Terminal application, you can open a contextual menu by Control-clicking (or right-clicking) within a terminal window. Figure 7-16 shows the default contextual pop-up. Interface Builder makes it easy to add new items to existing menus. In the following example, you’ll discover how to create a new item, add a keyboard equivalent, and connect it to provide real functionality in the application.

Terminal’s contextual pop-up.

Figure 7-16. Terminal’s contextual pop-up.

  1. Return to Interface Builder and to Term.nib. If the Terminal design window is open, close it.

  2. In the NIB window, double-click ContextMenu to open the menu editor.

  3. Clear Scrollback appears in the middle of the menu (Figure 7-17). Select this item.

  4. Choose Edit Duplicate (⌘-D) to create a second copy of the Clear Scrollback item. The new copy appears below the original.

  5. In the copy, double-click the words Clear Scrollback. An edit field appears. Change the words to Open Help and press the Return key to accept the new name.

  6. Double-click the ⌘-? and the Info panel updates to reflect the new changes (Figure 7-18).

  7. In the Info window, select Connections (⌘-2) from the pop-up.

    ContextMenu’s menu editor window.

    Figure 7-17. ContextMenu’s menu editor window.

    Figure 7-18. The Info panel shows the settings for the currently selected menu item.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required