Cmd + click to move status item

The built in battery, wi-fi, sound, etc, Apple supplied status items, can be dragged to any position on the menu by using cmd + click and drag:

How can I support similar functionality in my own status item?

Answers


There are two ways to get menus on the right side of the menu bar. The officially supported way is creating an NSStatusItem in your app. The other ways is creating an NSMenuExtra. You've noticed one difference: NSStatusItem menus are fixed in place, whereas the menu extras can be moved around by cmd-dragging them.

The other major difference, and the reason 3rd-party menu extras are not officially supported, is that unlike status items (which run as separate applications), menu extras are loaded into the address space of the SystemUIServer process. That means if they go haywire and crash, they can take down the UI.

You can see the Menu Extras installed on your system at /System/Library/CoreServices/Menu Extras. It may still be possible to create your own and have the OS load them, but you will run into problems if you try to ship the result. Better to go to bugreport.apple.com and let them know that NSStatusItems ought to be draggable.

Wikipedia has more info on Menu Extras, including some links to a tutorial on building your own.


Need Your Help

Android problems when adding action bar in Eclipse

java android eclipse android-actionbar

I tried to add a Up button for a activity by following the tutorial @

How can I programmatically read a Adobe DRM'd Epub?

adobe drm epub

I am writing an ebook reader that supports the epub format (i have the parsing of open epub working), but I would like to support the reading of Adobe DRM locked epubs.