keyboard shortcut / command line for rotating screen /display

ryanhanks

Registered
Hi,

Does anyone know how I can assign a keyboard shortcut to toggle the rotation of my display between 0 and 90 degrees?

Does anyone know how I can control the rotation of the screen from the command line?

Thanks,
Ryan H
 
Wow, you have asked for two very difficult things.

ryanhanks said:
Hi,

Does anyone know how I can assign a keyboard shortcut to toggle the rotation of my display between 0 and 90 degrees?

You'd have to assume that the Displays system preference was scriptable, which it isn't. You might have a hook to the screen orientation through System events, but I don't know. As somewhat of an AppleScript whiz, I would look at your second question for the answer.
ryanhanks said:
Does anyone know how I can control the rotation of the screen from the command line?

If you can find out which .plist controls the screen orientation/resolution (I think it's one of the byhost prefs in ~/Library) you can use the defaults command to read and write the necessary values to the relevant property list. Then, you can wrap it in an AppleScript using "do shell script" and then execute it using the XKeys utility which can launch an AppleScript using an Fkey.

Also, from what I know from messing with the displays property lists, it's going to be a lot more complex than simply:

defaults write com.apple.displays -int 90 or something similar.
ryanhanks said:
Thanks,
Ryan H
 
Back
Top