When you right click on the application in the dock a context menu pops up. How can I add a menu item to this?
As for example with Safari you got New window in the context menu.
When you right click on the application in the dock a context menu pops up. How can I add a menu item to this?
As for example with Safari you got New window in the context menu.
Adding Static Menu Items With a Nib File
If your application needs to add static items to the application’s Dock tile’s menu, you can provide those items in a nib file. To do this, perform the following steps.
dockMenu
outlet of the file’s owner (which by default is NSApplication
) to your menu.Info.plist
, using the key AppleDockMenu
. The nib name is specified without an extension.Dynamically Adding Menu Items With the Application Delegate
An application can also provide items dynamically to your application’s Dock tile’s menu. To do this, your application’s delegate object provides a applicationDockMenu:
method. This method returns a NSMenu object that provides all the custom menu items you wish to add to the menu. If you also provided a menu using a nib file (see Adding Static Menu Items With a Nib File), any menu returned by your delegate replaces the menu provided in the nib file.
© 2022 - 2024 — McMap. All rights reserved.