Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

I have a MacBook Pro and two Thunderbolt displays at work. I work with the MacBook lid-closed because it's overkill and I don't have enough desk space anyway.

Every morning I show up to work and plug in a Thunderbolt cable and power cord, but my primary screen (the one in front) and secondary (one off to the side) are swapped. I have to this stupid song and dance in the Displays / Arrangement system preference and it's getting annoying:

enter image description here enter image description here

Is there a way to do this automatically? With a setting? An AppleScript? Is there a reason that the screens are always flipped?

share|improve this question

3 Answers 3

Update: I think I got it.

There's a utility called cscreen which lets you control the display settings. Running it shows all displays:

$ cscreen
DisplayID  Index     Depth     Width     Height  Refresh
 4249fef       1        32      2560       1440     0
 4248344       2        32      2560       1440     0
use -h to display all usage options

Sure enough, you can force one of them to be primary (with menu bar):

$ cscreen -i 4248344 -p

You can script setting the second screen as the primary like this:

$ cscreen -l | perl -lane 'print $F[0] if $F[1] == 2' | xargs -I id cscreen -i id -p

Now, to bind to a key, I first created an AppleScript script, SwapScreen.scpt:

swapscreen

Then I used QuickSilver to bind the script to a F13:

quicksilver

Now, when I plug in my MacBook, if the screens are messed up, I simply hit F13. Sweet!

share|improve this answer
    
But using cscreen doesn't solve the arrangement problem for me. My 23" monitor is on the left, and my 13"MBP on the right. However, using cscreen, will reverse that, so I have to move the cursor the opposite direction to move from one display to the other. Even when switching back (ie.using cscreen to toggle) the arrangement is reversed. What's needed is a way to programmatically fix the arrangement in the same way as when you drag one to the left/right of the other. Setting the arrangement in the root user as suggested by DKMN here did not work in my case. –  applehelpwriter Jan 30 at 14:12

Been there, done that, with Mac Pro and 4 monitors. ;0

There is an odd bug/feature in OSX that makes default display settings privileged. This behavior has not changed with 10.9 and I believe is what is causing your problem. It is very poorly-documented and discussed on the web.

A permanent solution:

  1. Log on as the root user (you will have to temporarily enable it).

  2. Set the Display arrangement to what you want (as you show above)

  3. Log back on as whatever you like

It is somewhat non-obvious how to enable the Root User for interactive login, though not hard. Here is the official Apple guide:

http://support.apple.com/kb/PH113311

I would disable it when done for security reasons.

share|improve this answer
    
BTW I also worked around this with a small app for a while... –  DKMN Nov 17 '13 at 22:12
    
Any chance you could share said app, please? –  BarrettJ Dec 16 '13 at 1:16

It should remember the external setttings.

Did you try to swap the cables behind the monitor in order to invert the connection order? Maybe could do the trick.

A very easy solution is waiting one months and upgrade to OS X Mavericks, where you will have the possibility of having the menu bar and dock on both screen

share|improve this answer
    
Yes, displays have been swapped repeatedly. I have hesitation toward upgrading to a dot-zero revision of Mac OS X, though. –  a paid nerd Sep 23 '13 at 23:11

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.