[Feature Request] Add percentage controlls to for "Move and Resize Front WIndow"

With larger monitors like ultra-wide it would be better to have more control over windows sizing.
Please allow us to control the desired width/size by using a percentage of the total screen width/height.
I would like to be able to express "take 25% of screen width" rather than calculating this value manually for the connected monitor.

Consider this image and think about how would you set this scenario up in Keyboard Maestro - you would have to calculate these percentages manually :pensive:

The custom percentage-driven layouts available in the move and resize are indeed percentage-driven (9 layouts Left Column, etc.), but they are quite limited. Keyboard Maestro contains 9 of them, while Rectangle contains almost 50 and this is still not enough.

Being able to enter percentages would help a lot.

Keyboard Maestro gives you the tools to do all of them.

Keyboard Maestro has no actual presets for window positions, it just has default values which you can adjust.

Use the SCREEN or SCREENVISIBLE functions and the WINDOW function and you can do whatever you want with whatever offsets or percentages you like. There is an infinite variety (technically finite on any given monitor due to the limited number of resolutions and pixels).


You can. Keyboard Maestro just has default values for a few layouts, but you can do whatever you want with whatever percentages you like.

You can also use the three parameter version, so for 25% — 75% you would use left and width as:


Adjust the percentage however you like.

oh wow, thx. I was getting it completely wrong, but Now I get the idea. This is great!

One last question
Assuming I have two screens:
3546x2234 - laptop
5120 x 2160 - external

How can I set a condition to resize windows differently when an active window is on a given screen?
I have used `If All Conditions Meet..." but I am not sure how to specify the exact condition there

Another condition that interests me:
I am setting the window size and position to:
SCREENVISIBLE(Front,Left, 25%)

Now how can I verify that window already has this position? (so I can set another one)

You can test for which screen the frontmost window is on by using the Token %Screen%Front%

This will return four numbers and you can have your condition to match that string of numbers. For example my main screen is 0,0,3008,1692
To find out what the numbers are you can make a simple test Macro that just has one Action in it, to display the text %Screen%Front% Run this macro when the front window is on each of your screens to make a note of the numbers returned.

Then you can use that information to move/resize the windows differently depending which monitor they are on. Probably best to use a Switch Case Action:

token:Screen [Keyboard Maestro Wiki].

1 Like

So I should be fine with this 2nd monitor.

Getting back to the window position. If I set the window position using the SCREENVISIBLE function (that accepts coordinates) I need to have a way to get these coordinates.

Any idea how to achieve this?

You can directly compare the coordinates from the frontmost window with any screen coordinate to see if a calculation returns as true.

For example WINDOW(Top) = SCREENVISIBLE(Front,Top)


Note that this is matching a Calculation and not text (as the Functions WINDOW and SCREENVISIBLE are numeric and not text).

1 Like

You can use calculation conditions to compare WINDOW(1,Left) with SCREEN(Internal,Left) and SCREEN(Internal,Right). Or you can use SCREENINDEX(Front).

The same, compare using the WINDOW function.

I am still not sure how to check if the active window has the exact position and size.

How to check if the Window(Top) equals all of these?

In theory, you just have to compare 4 pairs of numbers and there are a few ways of doing that.

But in testing this I found a problem. Keyboard Maestro will attempt to move and resize the front window to the maths you are using but if the window size is not permitted it will do its best which means the final window size might not match exactly with the initial calculation.

For example, the Keyboard Maestro Editor window itself cannot be made narrower than a certain width of pixels and on my main screen that width is wider than 25% of the screen width. Finder windows can be 25% of the screen width so, in that case the matching of the numbers works.

Here is an example Macro that you can use to test this. (The reason I first saved the calculation results to Variables is that it makes it easier to use those numbers later in the Macro. This is something you might consider doing as it means you only have to type the calculations once.)

EXAMPLE Move Resize and Check Position of Window.kmmacros (6.2 KB)

Click to Show Image of Macro

When I ran this Macro from the Keyboard Maestro Editor window I got this result:

And when I ran the Macro on Finder window I got this:

If I am understanding correctly, you want to select a window and run the Macro. If the window is already in one of your preset positions you want to move/resize the window to a different position?

In which case, just checking left and top coordinates match might be sufficient and you could do that like this:

EXAMPLE Check for Position Match.kmmacros (5.5 KB)

Click to Show Image of Macro