On either side of the iMac, there is a dell 4K display 27".
The left Dell 4K is in Portrait mode. The others are in Standard landscape mode.
Sometimes when waking up from sleep, the left 4K will be turned into standard landscape mode and the right, in portrait mode.
Needless to say, this is a complete pain to undo since you have to move your mouse in that screen orientation to change the display settings via the system preferences...
I am aware and use SwitchRez but Catalina even with SIP turned off, sometimes does not work and was hoping for a KM solution.
It has a rotate feature which is supposed to work with external monitors as well.
You could assign a keyboard shortcut in Keyboard Maestro to the appropriate display_manager.py command. I believe the proper command would be:
/usr/local/bin/display_manager.py rotate 90 0
Unfortunately I do not have an external monitor to test it. The final 0 (zero) refers to the number of the monitor (starting at zero). I would assume zero would be the left-most monitor, but if not, try 1 or 2 such as:
It's kinda of wonky. numbers for displays off. but I can work around but changing the 3rd display downgraded the Rez on the first display. I will fiddle with it some more though.
Maybe there is some call in it to the OS that I could duplicate with a swift tool.
Why rotation is not supported?
Apple does not provide any perfect way to rotate screen in macOS. Therefore, some screens may support rotation, others may not. Most MacBook don’t support screen rotation, thus this function will not work in Displays.
I am hoping that apple's Pro Display screen (and the fact they show off screen orientation changes often) will push apple to make this a standard OS call.
On macOS 10.15.3 I can rotate my external HP display with this:
use AppleScript version "2.4" -- Yosemite (10.10) or later
use scripting additions
tell application "System Preferences"
reveal anchor "displaysDisplayTab" of pane "com.apple.preference.displays"
end tell
tell application "System Events"
tell process "System Preferences"
tell window "HP LP2475w"
tell tab group 1
tell pop up button "Rotation:"
click
delay 1
click menu item "90°" of menu 1
end tell
end tell
repeat until exists sheet 1
delay 0.5
end repeat
-- click button "Revert" of sheet 1
click button "Confirm" of sheet 1
end tell
end tell
end tell
Replace the HP LP2475w your actual window title and the 90° with your desired rotation (90°, 180°, 270°, Standard)
Thank you. there is something to this. I am making progress as at least it is working to an initial rotate. I need to add some logic to get it to rotate back. Or not. may save and use this only when I know screen x needs to rotate y....
I added the macro to my menubar KM item and it worked great this morning.
Here is the code in case anyone needs:
use AppleScript version "2.4" -- Yosemite (10.10) or later
use scripting additions
tell application "System Preferences"
reveal anchor "displaysDisplayTab" of pane "com.apple.preference.displays"
end tell
tell application "System Events"
tell process "System Preferences"
tell window "Right"
tell tab group 1
tell pop up button "Rotation:"
click
delay 1
click menu item "Standard" of menu 1
end tell
end tell
repeat until exists sheet 1
delay 0.5
end repeat
-- click button "Revert" of sheet 1
click button "Confirm" of sheet 1
end tell