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
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.
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).
SCREENVISIBLE(Main,Width)*25%
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:
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%)
SCREENVISIBLE(Front,Top)
SCREENVISIBLE(Front,Width)*50%
SCREENVISIBLE(Front,Width)*50%
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:
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.
CHECK_IF_POSITIONED_USING_CORDINATES_FROM_SCREEN_VISIBLE(Front,Left, 25%)
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.)
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: