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.
(Source: https://developer.apple.com/library/mac/documentation/Carbon/Conceptual/customizing_docktile/docktasks_cocoa/docktasks_cocoa.html#//apple_ref/doc/uid/TP30000986-CH3-SW7)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With