4

I try to launch an app in the background, without activating it. I just this method on NSWorkspace to launch it in the background :

[[NSWorkspace sharedWorkspace] launchAppWithBundleIdentifier:bundleID
                               options:(NSWorkspaceLaunchWithoutActivation | 
                                        NSWorkspaceLaunchAllowingClassicStartup)
                               additionalEventParamDescriptor:nil launchIdentifier:NULL];

The only problem is that it doesn't activate the app but it does switch space to the assigned space of that application. Any way to avoid this?

1 Answer 1

2

Do you have any control over the app that you're launching? If so, override the window collection behavior of its windows. You'll probably want to make this controllable via a command line argument or similar methods, so the Spaces settings are still respected when the app is launched manually by the user.

If the app that you're launching is not under you control, how about using AppleScript to temporarily override its Space assignment, then change the assignment back to the original value?

1
  • No, I don't have any control on apps that I launch. Using AppleScript would not work since the switching of space only append momentarily during the lunch process. And since AppleScript can only change space when the app is launched, it would not work...
    – gcamp
    Jun 16, 2011 at 21:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.