I have an external display. Specifically, an Apple Studio Display that I use with my MacBook Pro.
Is it possible to use this external display's orientation as a trigger?
Specifically, this would mean the ability to trigger macros when the display has been rotated from landscape/horizontal to portrait/vertical orientation, and separately the ability to trigger macros when the display has been rotated from portrait/vertical to landscape/horizontal orientation.
Mac OS itself automatically detects and adjusts when the Apple Studio Display is rotated, so I have to imagine this "status" is stored somewhere, and thus could potentially serve as a trigger?
The Display Layout Changed triggermay work for this, as I know it catches adding and removing displays as well as resolution changes. So it might also catch orientation changes, but I’m not 100% certain. If it does, you could then use the Screen token, perhaps %Screen%External% to determine orientation and go from there.
For example, right now the token %Screen%Main% return 0,0,1512,982 (I’m using my MacBook screen as an example because I’m not at my desk and don’t have my external monitor hooked up, but you’ll get the idea).
That’s standard orientation: the first 0 indicates horizontal position, the second 0 the vertical position, 1512 is horizontal resolution and 982 the vertical resolution. Since I already know what my resolution is, then I would also know that if that same token returned 0,0,982,1512, then the screen is rotated, since the vertical resolution is now greater than the horizontal.
I would dare to say that anytime you a greater digit in the 4th position (again, vertical resolution) than what the 3rd digit returns, it’s rotated... but I’ve never really worked with rotated monitors so I can not guarantee that.
If you wanted a real simple test case, you don’t even need the entire token, you could use the token as an array, just extracting either the 3rd or 4th value from it and using that in a switch action, or if/then/else action. See my sample macro below for what would work on my external monitor; you would need to adjust the 2560 and 1440 to whatever your external monitor’s resolution is.