I would like to programmatically manipulate the menu bar icons on macOS, ideally supporting Yosemite, El Capitan and Sierra in Swift. What I'm mostly looking for temporarily hides some or all third-party icons (when you have a dozen of them, they seem crazy there).
An example implementation is Bartender ( https://www.macbartender.com ). I would like to create a simpler version where the menu bar icon app will toggle all other third-party icons except itself when it is clicked. I do not need to display icons anywhere else.
Looking at Bartender, it seems that there is a need for a helper application with administrator rights. What else, if I debug one of my applications that creates a menu item, I see the following in the console while Bartender is running:
2016-12-06 10:14:47.936 MyApp[2747:22676] Bartender: Loaded BartenderHelperTwoOneThree
So it looks like Bartender is introducing his assistant into the process, right? I just checked and the Helper is the BartenderHelper.osax file inside /Library/ScriptingAdditions . This package contains a binary file with the same name, as well as a PlugIns folder containing BartenderHelperTwoOneThree.bundle that contains a binary file with the same name.
I have no idea where to look, and my searches on SO and Google have so far given me nothing. I have no sandbox restrictions.
Thanks.
cocoa swift swift2 macos
beeb
source share