I have certain applications set to open in certain spaces, but would like them to open in the background and not switch the space just so I can watch them open.

link|improve this question

feedback

2 Answers

up vote 2 down vote accepted

This will prevent any autoswitching of Spaces, which meets your criteria, but does other things, too, that you may not want:

defaults write com.apple.dock workspaces-auto-swoosh -bool false
osascript -e 'tell application "Dock" to quit'
link|improve this answer
Thanks; I'll give it a try. Do you know what other things? Do I just set the boolean back to true to undo it? – Philip Oct 17 '09 at 21:39
@Philip: Yes, setting it to true will undo that. – Chealion Oct 17 '09 at 23:39
@wfaulk, yes, what are the "other things" this command does? – Josh Oct 28 '09 at 16:52
1  
@Josh: largely that Cmd-Tab switching to an open application will not switch to a Space with an open window. Basically anything that would automatically switch you to a different space will be disabled. – wfaulk Oct 28 '09 at 20:09
Too bad there doesn't seem to be anything that can just solve the problem without the unwanted side effects. Bummer. – Philip Jan 12 '10 at 3:39
feedback

There is also the '-g' option to 'open' that will run programs in the 'background' in that they won't steal focus away from the current app. Try

open -g /Applications/iCal.app

for instance. See here for details:

http://developer.apple.com/library/mac/#documentation/Darwin/Reference/ManPages/man1/open.1.html

If you want to edit the Info.plist of some application to make this permanent, you can add the key

<key>LSBackgroundOnly</key>
<true/>

See here for details:

http://developer.apple.com/library/mac/#documentation/General/Reference/InfoPlistKeyReference/Articles/LaunchServicesKeys.html#//apple_ref/doc/uid/TP40009250-SW1

link|improve this answer
I tested those two (and setting LSUIElement to true) with Minuteur.app, but none prevented it from stealing focus. – Lri Jul 31 '11 at 8:50
open -ga iCal seems more like a special version of reopen app "iCal". If there's an existing window of the application, it doesn't visibly affect the stack of open windows or applications. Otherwise it opens a new window behind the frontmost application, and moves the targeted application last in the application switcher. – Lri Jul 31 '11 at 8:55
1  
LSBackgroundOnly -bool true is meant for faceless (non-GUI) applications. It removes the menu bar and dock icon (like LSUIElement -bool true), but it has some other side-effects (like disabling keyboard input and making windows of the application appear behind windows of the frontmost application). – Lri Jul 31 '11 at 8:56
This is nonetheless very interesting.... Maybe there is after all a more permanent way to make the open -g style change w/o other side-effects? – Philip Jul 31 '11 at 11:47
feedback

Your Answer

 
or
required, but never shown

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