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.