I am trying to make a OS X application that automatically hides “⌘H, not minimize” all other applications when it is launched, and I can’t seem to get it to work. This is what I have for accomplishing this so far…
- (void)awakeFromNib
{
[super awakeFromNib];
[[NSWorkspace sharedWorkspace] launchAppWithBundleIdentifier:@"com.Developer.myApp"
options:NSWorkspaceLaunchAndHideOthers
additionalEventParamDescriptor:NULL
launchIdentifier:nil];
}
NSWorkspace class reference
Note: if your
awakeFromNibmethod is executed, it means your application is launched.So trying to launch it again won’t work.