6

I have a MacBook Pro that I use in two different 'modes', mobile and desktop.

Mobile is for when I'm using just the MBP with the integrated trackpad, keyboard, and display.
Desktop is for when I'm using it with external displays and an external keyboard and mouse, usually in clamshell mode.

A couple of facts have led me to look for a way to configure a different Dock to appear in each mode:

  1. The resolution of the external displays is higher than that of the internal display, so I have more room for extra apps/folders/spacers in the Dock.
  2. I generally use a different set of main apps in each mode.

So, is there a way to configure two different Docks in OS X and switch between them either automatically based on the presence of an external display or manually?

8

DockSpaces is nice and convenient, but annoyingly unscriptable. So, I wrote two little shell scripts, one to change to my desktop Dock and one to change to my mobile Dock.

The desktop script is triggered on arrival in my Home context in ControlPlane, and the mobile script is triggered by departure from it.
The desktop context is defined based on the presence of my external displays: enter image description here

Here's how the scripts work:

I save a copy of both Docks in my Documents folder (the Dock configuration is stored in ~/Library/Preferences/com.apple.dock.plist).

When I switch from one to the other, I replace the appropriate file in my Documents folder with the current file in my Preferences so that changes I've made to the Dock are saved. Then I copy the alternate Dock from my Documents to my Preferences. Finally, the Dock process is restarted so that the changes take effect.

The Scripts:

To Desktop:

#!/bin/bash

cp ~/Library/Preferences/com.apple.dock.plist ~/Documents/Docks/mobile.plist
cp ~/Documents/Docks/desktop.plist ~/Library/Preferences/com.apple.dock.plist
killall Dock

To Mobile:

#!/bin/bash

cp ~/Library/Preferences/com.apple.dock.plist ~/Documents/Docks/desktop.plist
cp ~/Documents/Docks/mobile.plist ~/Library/Preferences/com.apple.dock.plist
killall Dock
  • Was stuck with Sidekick until today. I'll never look back. – Cyrille Feb 5 '13 at 20:54
1

I found a manual solution, Dock Spaces. It will cost you a little bit under $8, though. Hopefully that's not an issue.

As for automating it, I'm not sure if it is scriptable or not, but it does not have automation like this built-in.

1

DockSpaces is the answer to your question. DockSpaces allows you to create docks with different applications in each dock. It does not have the automation built in, so I would recommend to you an application that you recommended to me, ControlPlane. You should be able to change docks based on the presence of an external display.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .