Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Darkroom

Guest
Original poster
Dec 15, 2006
2,445
0
Montréal, Canada
to add them programatically, i do this (EX: Eject item)

Code:
NSTask *showEjectTask;
showEjectTask = [[NSTask alloc] init];
[showEjectTask setLaunchPath:@"/usr/bin/open"];
[showEjectTask setArguments: [NSArray arrayWithObject:@"/System/Library/CoreServices/Menu Extras/Eject.menu"]];
[showEjectTask launch];
[showEjectTask release];

but how is it possible to remove that same eject menu item programatically? it seems that /usr/bin/killall is only good for system apps (Safari, Finder, etc.) and that i can't set a array path for system apps to be used in setArguments.

so neither of these work:

/usr/bin/killall /System/Library/CoreServices/Menu Extras/Eject.menu
/usr/bin/killall Eject.menu
/usr/bin/killall Eject
 
The reason you can open them is because they're treated like documents/packages, so they open with whatever opens .menu packages (SystemUIServer). They aren't processes, only plugins, so killall doesn't work. I'm guessing you'd have to edit the preferences plist that SystemUIServer uses, and then killall SystemUIServer to get it to relaunch.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.