I am thoroughly enjoying the pixels on the new MacBook Pro. Can pretty much do all multi-monitor configurations I need/use/want on a Mac using the one screen. Only problem is this is using a combination of +/- 1.5x 1920×1200 (my default workable resolution for years — previous MBP was a 17″ and prior to that I was on a combination of Wintel laptops with similar) and all-out 1x 2880×1800 (which is fucking wonderful) and having to switch between the two (the latter not having a convenient system preference). So, I set about investigating the possibility of writing an OS X utility / menu bar app to help do the work for me…
Enumerating NSScreen gets interesting results. E.g. this:
|1 2 3 4 5 6 7 8 9 10 11||
|1 2 3 4 5 6 7 8 9 10 11 12 13||
However, inspecting from CGDisplayMode isn’t so fruitful:
(Based pretty much entirely on the Quartz Display Services doc here)
|1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36||
|1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18||
Which doesn’t seem to relate to anything useful — in fact it really doesn’t. It’s a list of the 1x resolutions you can force the display into. Setting one of those (using CGDisplaySetDisplayMode or CGConfigureDisplayWithDisplayMode) will switch the display into a 1x mode with the specified resolution. A great way of getting it into native 2880×1800 mode (though I was already using SetResX for that).
Next thing I stumbled upon was that if you go to /System/Library/Displays/Overrides/DisplayVendorID-610 and grep ‘ 2x’ * you see this:
|1 2 3 4 5 6 7 8 9 10 11 12 13 14||
Which is more interesting if you look at the content of one of those files, e.g.:
|1 2 3 4 5 6 7 8 9||
e.g. — (being) that those are specifically IOFlags.
In this thread on macrumours.com it’s noted that SwitchResX caused issues because one of the above files vanished — and the system was subsequently not able to provide anything other than 1x resolutions.
Presumption (certainly not a conclusion — this the first bit of under the hood poking around I’ve done in OS X) is that there’s something happening that’s not publically exposed, but for legacy support (games that set full screen device resolution modes spring to mind), the old behaviour of CGDisplay… is retained. NSScreen (and window, etc) obviously have extensive support — it’s just presented around CGDisplay. NSUserDefaults in the NSGlobalDomain also fails to provide access to whatever it is that System Preferences is doing.
I found the updated version of SetResX on reddit, now called RetinaDisplay Menu and conveniently including source code (thanks
http://www.phoenix-dev.com/). Above presumption is pretty much confirmed — it seems to be dynamically linking to the private API method CGSGetDisplayModeDescriptionOfLength and building the structure required to contain the results (including the particularly pertinent float density — e.g. scale). Then using CGSConfigureDisplayMode to actually make the mode change (instead of CGConfigureDisplayWithDisplayMode).
Go get Retina DisplayMenu (linked from reddit). It does what I set about doing, and it seems to work right now. Unlikely we’ll see it on the Mac App Store due to the private API calls (which is what I was hoping to be able to do with a utility in the first place), but it’s no major hassle to download, place somewhere convenient and add it to your user/login items preferences.
For the application level stuff, best resources so far are: