Setting a Custom Resolution on a Retina MBP
- June 16th, 2012
- Posted in Code . Mac Apps
- By admin
- Write comment
The new Macbook Pro, along with its retina display, includes a new, simplified display settings preference pane. This preference pane, while allowing the user to switch between various retina-friendly preset resolutions, does not allow for the selection of custom resolutions. In fact, the available resolutions do not even include the display’s native resolution, 2880×1800.
Despite the simplified preference pane, however, it is still possible for an application to modify the resolution manually. In fact, I personally crafted a simple command-line application to do just this: the application allows the user to set many common resolutions, including the native, full resolution. A user can download this executable with this link; it can be executed by dragging the unzipped file into Terminal, typing a width, a space, and a height (both in pixels), and hitting enter.
I have posted the source code to GitHub. In the future, I plan to craft a more user-friendly version of this software; typically a CLI is scary to users, especially when they are required to compile it themselves through Xcode. As of now, the command-line executable supports additional arguments to set fields such as the bit-depth and scale (a value of 2 for retina display, 1 for regular displays). Since the program only allows the user to specify pre-defined screen preferences which have been built-in to I/O Kit’s drivers, a –modes flag allows the user to list all available settings.
One other technical note: in the process of working with Apple’s Quartz Display Services framework, I discovered something which was essential and which Apple’s API refused to provide: the ability to get a dictionary of attributes for a given screen mode. However, I noticed that the CFType which apple would give me responded to -description, printing out all of the desired info. Once I knew that this data structure was hiding my precious metadata, I did some hacking. I found the offset in the CFType at which a pointer to the info dictionary is stored; I then made a method to retrieve that dictionary. While this is a dirty, disgusting hack, it had to be done.
Wow, very interesting tool! I spent a few minutes to create a menubar item out of what you did – you can check it out here:
http://www.sendspace.com/file/5219np
Gah rumor is it segfaults on open. Oh well…was worth a shot.
Very cool. Can it set the resolution to 1440×900 with no scaling effectively disabling retina?
Nice job, you should post a screenshot of OS X at 2880×1800