Visible screen width minus Global Macro Palette width

Hi there,

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”.

Any help in this direction is welcome,

A couple of questions likely need to be answered to be able to come up with a solution.

  1. How many monitors do you use?
  2. Which side of the screen do you have your GMP positioned?

I have an idea but I would need that info before I could work on something.


Hi Chris,

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.)

Seeing forward to your idea,

Hey Yves,

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.

Position front window next to and up to the GMP.kmmacros (8.1 KB)

Macro screenshot (click to expand/collapse)

Another option is to use Better Snap Tool to set up snapping regions on the screen.

It makes it really easy to snap windows to specific locations.


Very true. I hadn’t considered that even though I used to use that feature on BetterTouchTool.

Hi All,

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:

So far this seems to work most of the time and on my internal and two monitors setup.

Mega kudos to cdthomer for his solution.

1 Like

Glad you got it worked out!

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.

Run according to screen count.kmmacros (1.9 KB)

Switch action with %Calculate%SCREENCOUNT% text (click to expand/collapse)

That’s a great tip and immediately implemented :+1:t3:

1 Like

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. :sweat_smile: so I try and share that info with folks when I see that.

1 Like