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.

Figure 7-16. Terminal’s contextual pop-up.
Return to Interface Builder and to Term.nib. If the Terminal design window is open, close it.
In the NIB window, double-click ContextMenu to open the menu editor.
Clear Scrollback appears in the middle of the menu (Figure 7-17). Select this item.
Choose Edit → Duplicate (⌘-D) to create a second copy of the Clear Scrollback item. The new copy appears below the original.
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.
Double-click the ⌘-? and the Info panel updates to reflect the new changes (Figure 7-18).
In the Info window, select Connections (⌘-2) from the pop-up.

Figure 7-17. ContextMenu’s menu editor window.
Figure 7-18. The Info panel shows the settings for the currently selected menu item.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access