Cmd + click to move status item

Built-in battery, wifi, sound, etc. Apple provided status items, you can drag them to any position in the menu using cmd + click and drag:

plSeX.png

How can I support similar functions in my own status element?

+6
source share
1 answer

There are two ways to get the menu on the right side of the menu bar. An officially supported way to create NSStatusItem in your application. Other ways to create NSMenuExtra . You noticed one difference: the NSStatusItem menu NSStatusItem fixed in place, while additional menu options can be moved using cmd-drag.

Another significant difference and the reason why third-party auxiliary functions of the menu are not officially supported is that, unlike status items (which run as separate applications), additional menus are loaded into the address space of the SystemUIServer process. This means that if they go away and crash, they can remove the user interface.

You can see the menu option installed on your system in /System/Library/CoreServices/Menu Extras . You may be able to create your own and load the OS, but when you try to send the result, you will run into problems. It’s better to go to bugreport.apple.com and tell them that NSStatusItems should be dragged.

Wikipedia has additional information about menu options , including some links to a tutorial on creating your own .

+11
source

Source: https://habr.com/ru/post/919631/


All Articles