Im'using macOs Sonoma with Stage Manager.
I need to create a macro that will center the window of any application in focus, across two monitors, with margins from the screen edges, while taking into account the possible presence of the Stage Manager on the left side of the screen, which appears when there are multiple windows open on one of the desktops.
and your question is ?
How can I get the visibility status of the Stage Manager on a specific desktop?
As far as I know, there's no official way to determine if Stage Manager is active or not. I'm not even aware of any unofficial ways.
A Stage Manager window isn't a window of any sort that can be seen by any other app. Looking at one with Accessibility Inspector (one of Apple's dev tools), it appears as a button owned by the WindowManager process.
But I don't know how you'd detect its presence.
-rob.
I understand.
I am exploring different solutions to reach a resolution, including an app called Rectangle.
Although it doesn’t have automatic triggers like Keyboard Maestro, meaning each arrangement can only be activated by shortcuts, the one that allows centering the active window, with margins from the screen edges, manages to account for the visibility of Stage Manager on a specific desktop, in case there is only one window and it is not visible.
However, I have no idea how they achieved this.
If Apple doesn’t provide an official method to determine it, they might have implemented some solution based on other indicators, such as the number of windows present on that desktop, perhaps.
Anyway, I might work around the problem by launching the Rectangle shortcut via a trigger in Keyboard Maestro, even though this would involve two applications and therefore two background processes.