Changing Dock position automatically

Discussion in 'macOS Sierra (10.12)' started by djon41, Mar 9, 2017.

  1. djon41 macrumors regular

    Joined:
    Jan 7, 2007
    #1
    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?
     
  2. MacGizmo macrumors 6502a

    MacGizmo

    Joined:
    Apr 27, 2003
    Location:
    Arizona
    #2
    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.
     
  3. Weaselboy Moderator

    Weaselboy

    Staff Member

    Joined:
    Jan 23, 2005
    Location:
    California
    #3
    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.
     
  4. djon41, Mar 10, 2017
    Last edited: Mar 10, 2017

    djon41 thread starter macrumors regular

    Joined:
    Jan 7, 2007
    #4
    This looks promising! I'll investigate and let you know if I succeed.
    --- Post Merged, Mar 10, 2017 ---
    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!
     
  5. BrianBaughn macrumors 603

    BrianBaughn

    Joined:
    Feb 13, 2011
    Location:
    Baltimore, Maryland
    #5
    Does the dock switch back properly when the monitor is removed?
     
  6. Weaselboy Moderator

    Weaselboy

    Staff Member

    Joined:
    Jan 23, 2005
    Location:
    California
    #6
    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
    --- Post Merged, Mar 10, 2017 ---
    Oh good... that is a really great app for things like this.
     
  7. djon41 thread starter macrumors regular

    Joined:
    Jan 7, 2007
    #7
    Yeah, as Weaselboy said above, I set up a second rule that moved it back 'On departure' (to use the apps language) from my monitor.
     
  8. MacGizmo macrumors 6502a

    MacGizmo

    Joined:
    Apr 27, 2003
    Location:
    Arizona
    #8
    Awesome find, Weasel!
     

Share This Page