Changing Dock position automatically

djon41

macrumors regular
Original poster
Jan 7, 2007
133
6
Does anyone know of a setting/automator-task/third-party-app that will allow me to automatically change the dock position based on some event? I use an external monitor in a configuration above my MBP, so the laptop keyboard and trackpad are my input devices. This makes the 'bottom' position of the dock quite annoying, but I prefer it to be there when not using the dock.

Ideally I'd like it to automatically change dock position to 'left' when the monitor is plugged in, and then back to 'bottom' when the monitor is unplugged. Any ideas?
 

MacGizmo

macrumors 68000
Apr 27, 2003
1,678
997
Arizona
I don't know of any way to automatically have the dock relocate to a different screen edge based simply on an external monitor plugged-in.

Unfortunately, Apple isn't very flexible when it comes to Dock customizations such as this, and the fact that you want the Dock to move based on something hardware-related instead of a software-based event makes it even more difficult.

Perhaps someone knows of a solution, but I don't and couldn't find any in any searches. If it's just the visual annoyance, you could set the Dock to Auto Hide.
 

Weaselboy

Moderator
Staff member
Jan 23, 2005
30,458
10,263
California
Ideally I'd like it to automatically change dock position to 'left' when the monitor is plugged in, and then back to 'bottom' when the monitor is unplugged. Any ideas?
I believe you could get this working with the app Control Plane. You can setup the app to trigger certain things based on a monitor connecting, and one of those is an AppleScript or shell script. I found this that looks like the correct shell (Terminal) script to do what you are after.
 

djon41

macrumors regular
Original poster
Jan 7, 2007
133
6
I believe you could get this working with the app Control Plane. You can setup the app to trigger certain things based on a monitor connecting, and one of those is an AppleScript or shell script. I found this that looks like the correct shell (Terminal) script to do what you are after.
This looks promising! I'll investigate and let you know if I succeed.
[doublepost=1489166017][/doublepost]ControlPlane worked out just about perfectly.

I wrote a simple shell script:

Code:
defaults write com.apple.Dock orientation -string left
killall Dock
And had it run in a specific context set up in ControlPlane when my monitor is plugged in. There are a few seconds of delay before it detects the context switch, but that is easy to deal with. Thanks a lot!
 
Last edited:
  • Like
Reactions: Weaselboy

Weaselboy

Moderator
Staff member
Jan 23, 2005
30,458
10,263
California
Does the dock switch back properly when the monitor is removed?
I think you would need to setup a second Control Plane action with this to undo it.

Code:
defaults write com.apple.Dock orientation -string bottom
killall Dock
[doublepost=1489192195][/doublepost]
ControlPlane worked out just about perfectly.
Oh good... that is a really great app for things like this.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.