I’d like to set a window width to the visible screen width MINUS the width of the permanently visible Global Macro Palette. I tried to manipulate the width value of the “Move and Resize Front Window” action but so far I couldn’t subtract anything like for example “SCREENVISIBLE(1,Width) - 44”.
at work I have two external monitors and the GMP is on the right monitor on the right side. And when I am roaming I use the internal display of my MBP and the GMP is also on the right. (The monitor detection I have so far covered in my KM macro. It just annoys my, that my full-width and right half-width windows go behind the GMP.)
Since you have multiple monitors, which one is the main monitor? Left, middle or right?
I'll send you what I have so far, but in my very limited testing it only works on screens that have positive coordinates. So for instance, my setup is my iMac (physically located to the right), and an external monitor (physically located to the left of the iMac). The display configuration matches the physical placement; in other words, the iMac screen is to the right of my external screen. What this means is the external screen has negative coordinates which makes window positioning a problem sometimes. Why? Because macOS sees all screens as one large space, with 0,0 coordinates starting at whatever the main screen is and going from there. So my external screen, since it is to the left of my iMac, has negative coordinates, and makes the calculations difficult (at least for me haha).
This may or may not matter. If your screen to the very right is your main screen, then it should work just fine for you.
Many thanks for all the advice. In the end I went with a simpler solution: I’ve stored the width of the GMP in a global variable and resized the window to the screen width minus the GMP width:
Just an FYI, you don't need to pass a token/calculation to a variable to use it in subsequent actions. For instance, you can use the Text feature of an If or Switch action to calculate screen count on the fly.
See the example below to see how you can do the same thing with a Switch action, using the calculation %Calculate%SCREENCOUNT% in the text field. Using it this way, and in a Switch action instead of an If action will allow you to easily add more fields later on if you get a third monitor, because you're not limited to "this" or "that" like you are with an If action.
Good deal! I didn’t know about using tokens and calculations directly in If and Switch actions for so long, I ended up having a lot of macros with unnecessary variables that I spent some time cleaning up earlier this year. so I try and share that info with folks when I see that.