10.7: Set default workspaces for applications
Feb 01, '12 07:30:00AM
Contributed by: asmeurer
Heavy users of Spaces from Mac OS X 10.5 and 10.6 may be wary of upgrading to Lion, as it's been completely replaced by Mission Control, which apparently does its own workspaces thing.
Well, actually, the workspaces in Mission Control are the same as the Spaces from (Snow) Leopard. The biggest difference is that they are now one-dimensional.
But the important thing is that application bindings to spaces still works, even though the preferences to set them have been removed from System Preferences. If you already had this setup from 10.5/10.6, the settings should transfer over to Lion. Even so, you may want to modify them given the new behaviors.
Here is a small guide on how to set this up. I'm sure there are commands that could make this easier, and I hope that commenters will supply them. Actually, my real hope is that someone will code up a GUI for doing this.
The settings are in the file ~/Library/Preferences/com.apple.dock.plist. You're going to want to open this in a good text editor, like TextWrangler. Note that Library is now hidden by default in Lion. A good text editor like TextWrangler will be able to browser hidden directories. If your favorite editor doesn't for some reason, you can open it with the Terminal command:
open -a YourTextEditor ~/Library/Preferences/com.apple.dock.plist
Replace YourTextEditor with the name of your actual text editor.
Once you have this file, you will want to edit the key workspaces-app-bindings. If you used Spaces in (Snow) Leopard, this should already exist. Otherwise, you will need to create it by adding:
<key>workspaces-app-bindings</key>
<dict>
<key></key>
</dict>
somewhere in side the main <dict>. You may also need to add
<key>workspaces</key>
<true/>
above it (it's not clear to me, as I already had Spaces enabled).
Now, to add Application bindings, below the line, add lines like:
<key>ch.sudo.cyberduck</key>
<integer>4</integer>
Here, the number in the tag is the space you want to add, and ch.sudo.cyberduck is the CFBundleIdentifier of the application you want, in this case CyberDuck. There is probably a better command to find this, but you can usually find the identifier by looking at the Info.plist file inside the application package (like Cyber Duck.app/Contents/Info.plist) and looking for the CFBundleIdentifier key.
As far as I can tell the old Spaces settings regarding the number of spaces have no effect in Mission Control. The number of spaces created is equal to the largest number of the spaces needed for open applications. So if you have application A mapped to space 3 and application B mapped to space 4, and you only have application A open, there will be three space created. But if you open application B, there will be four spaces. I haven't tested this thoroughly, so I may be wrong, though.
To make an application appear in every space, set the integer to 65544. This is a little glitchy in Lion (the application will not appear until you have finished switching spaces), but it works.
Finally, some tips. First, you will probably want to disable space rearranging in the Mission Control preferences. Second, full screen applications still create their own space (to the right of the allotted space). Third, you can setup Keyboard Shortcuts for the spaces in the Keyboard System Preferences, under the Mission Control section of the Keyboard Shortcuts tab. If you have a number pad, this can be a useful way of creating an illusion of two-dimensional spaces. Just pretend that the spaces are arranged like they are in your number pad. If you had Spaces from (Snow) Leopard, these settings will be transferred over automatically. It seems that you can set a keyboard shortcut for any space, as long as it is in existence, except for spaces for full screen applications.
[crarko adds: There are a lot of variables involved here, so be sure to have backups of the plist files before changing them.]
Comments (9)
Mac OS X Hints
http://hints.macworld.com/article.php?story=20110731185230868