Is there a shortcut for rotating the screen in Mac OS X 10.10 (Yosemite)? If there is not a default shortcut, is there a way to assign one?
This is a fairly decent question. But there doesn’t seem to be a clean/off-the-shelf answer.
I found these AppleScripts (RotateDisplayScripts.zip) via this Mac OS X Hints thread that supposedly allow one to rotate screens via AppleScript (obviously) but I could not get them to work. Note that to get it to initially work, you need to go into “Security & Privacy” select the “Privacy” tab and then under “Accessibility” add AppleScript Editor to the list of apps that can control your computer; screenshot below. But like I said, even after that was done, they did not seem to work on my Intel-based Mac Mini:
And I found EasyPivot which seems to do exactly what you are looking for. That said, it was in the Apple App store at one point but now has been pulled by the author due to “…many issues with Apple APIs…” and such with no plans on re-releasing the app.
Hacked together a good enough solution using applescript that works on OS El Capitan (10.11.6) so YMMV. It's easy to kick it off with Quicksilver directly or via a Quicksilver trigger and takes about the amount of time it takes to physically rotate and adjust a monitor. Hope this helps someone!
This applescript switches the target display "DELL U2414H" to portrait mode with 270 degrees rotation. Note that the string "DELL U2414H" is from the window title representing said display under System Preferences > Displays. Not sure what would happen if it's run when there are two displays of the same make and model – feel free to report findings. Easy potential improvements would be to make it check state and toggle between the two most frequent orientations, but scarcity in time and documentation meant it was good enough for my use case as is. ¯\_(ツ)_/¯
tell application "System Preferences" activate end tell tell application "System Events" delay 1 click UI element "Displays" of scroll area 1 of window "System Preferences" of application process "System Preferences" delay 1 click window "DELL U2414H" of application process "System Preferences" delay 1 click pop up button 2 of tab group 1 of window "DELL U2414H" of application process "System Preferences" -- select 270° for portrait, for landscape replace 4 with "Standard" (with quotes) delay 1 click menu item 4 of menu 1 of pop up button 2 of tab group 1 of window "DELL U2414H" of application process "System Preferences" -- click the "Confirm" button, not necessary for "Standard" orientation delay 5 click UI element "Confirm" of sheet 1 of window "DELL U2414H" of application process "System Preferences" end tell tell application "System Preferences" quit end tell