In OS X Yosemite, how to keep the app switcher (or dock) on my main display?

I believe the app switcher (command + tab) is tied to where the dock "is". The dock is available on both displays, but I believe the last display in which you clicked on the dock is where it actually is.

So when the dock is on my secondary display, the app switcher shows on that display. Which throws me off and I would rather have the app switcher stay on my main display.

How can this be done?


App Switcher is controlled by Dock. Whichever display the dock bar is on, so is App Switcher. This applescript is how I reset Dock bar to main display:

tell application "System Events"
    set screen edge of dock preferences to right
    set screen edge of dock preferences to bottom
end tell

If you run Dock unhidden/visible, most likely the Dock will make a flash appearance on the rightmost edge. To get rid of the flash:

tell application "System Events"

    set autohide of dock preferences to true
    delay 0.2
    set screen edge of dock preferences to right
    set screen edge of dock preferences to bottom
    set autohide of dock preferences to false

end tell

You can bind the script to a keyboard shortcut so it can be invoked quickly when necessary.

If you always have Dock hidden, you can put the script in a loop with a preferred amount of delay, and run it as a daemon. This way the daemon will periodically make sure the dock is in main display.


Desired Effects Sought

  1. Hide Dock at Will
  2. Keep Dock on Main Screen

Hide Dock at Will

Set hotkey to hide dock

in OS X: System Preferences > Keyboard > Shortcuts > Launchpad & Dock

  • check "Dock Hiding On/Off”

  • Set hotkey for “Dock Hiding On/Off” to Control D (or whatever you want).

  • Set timing for Dock Hiding timing to long duration (as shown in the following commands). I set mine to 99 (I think) so I will not accidently trigger the Dock.

Set timing for Dock Hiding timing to long duration (as shown in the following commands). I set mine to 99 (I think) so I will not accidently trigger the Dock.

Enter this into Terminal to make the Dock show without a delay:

defaults write com.apple.dock autohide-delay -float 0; killall Dock

Maybe you want to have a long delay (5 seconds) so that you never accidentally trigger the Dock:

defaults write com.apple.dock autohide-delay -float 5; killall Dock

To restore defaults:

defaults delete com.apple.dock autohide-delay; killall Dock

Keep Dock on Main Screen

You would think this is easy, but what really screws things up is when you move an application to full screen. It wreaks havoc with the dock positioning as well as revealing. To fix the problem, I am now trying Lawrence Post for the Apple Scripts. I implement them using Keyboard Maestro (highly recommend that app for automating these things). Should the full screen situation create a dock positioning problem, I simply set a hotkey to execute the Apple Script and reposition the dock.

Still to do

Automate using Keyboard Maestro to sense the dock has been moved to other monitors and automatically put the dock back to the main screen without using a hotkey.