Search code examples
cocoaappkitnspopover

Display NSPopover above dock icon


How can I display an NSPopover above my app's dock icon?


Solution

  • There are two ways to customise the dock menu, based on if your application is running or not. See the Apple documentation for customising it when its open here:

    http://developer.apple.com/library/mac/#documentation/Carbon/Conceptual/customizing_docktile/docktasks_cocoa/docktasks_cocoa.html#//apple_ref/doc/uid/TP30000986-CH3-SW1

    To summarise, you basically provide a menu in the main application's XIB or storyboard which contains the extra menu options that you want to add to the dock menu.

    To customise your Dock icon's menu when the application is not running, see the guide here:

    http://developer.apple.com/library/mac/#documentation/Carbon/Conceptual/customizing_docktile/CreatingaDockTilePlug-in/CreatingaDockTilePlug-in.html

    Basically, you need to create a plugin which you drop into your application's resource folder. This works very like the original method, but executes inside Finder's dock process.