Relative or absolute screen positioning

I recently started running into a snag with my window positioning macros. I wonder if anyone has a suggestion? I use three screens. The center one and the right one are standard rotation. The left one is in vertical rotation. I have three macro keys set up to send whatever window is active to full screen size on any of my three screens. When I say full screen I mean filling the dimensions of the screen and not Apples idea of full screen.

Recently I changed the resolution on my center screen. It had been set to 1920 x 1080 when I wrote the macros. This is still what the other two screens are, 1920 x 1080. I decided to lower the resolution on my center screen as some apps use fonts that are too hard on my eyes. My main screen is now at 1280 x 720.

The problem is that, now that the main screen (the middle screen) has new resolution boundaries, the macros on the other two screens are not where they should be. I am still not sure if I will leave this main screen on the lower resolution setting or not. It would be nice if I could figure a way to rework these macros so that they won’t be affected by changing the resolution on the main screen.

Right now the macro for the left (vertical screen) looks like this:

Move and resize front window
Move and resize - 1200, - 58, 1200, 2876
the front window
In Front Application

I know it is possible to set absolute position somewhere … although I don't see this option in this dialog. What I want is to have the far right and the far left monitor screen sizes - which have not changed, still get the full screen size treatment from the macros.

I suppose a workaround would be to ask if the resolution is set to 1920 x 1080, then do this branch of the macro and stop, else, do this. But, that is assuming there is a way in KeyboardMaestro to read the current screen resolution for the center or the main screen.

Thanks in advance for any tips.

PS - I don't see any actions that speak to finding resolution. I only see; Decrease Screen Brightness, Find Image On Screen, Increase Screen Brightness, Screen Capture, Sleep Screen, Start Screen Saver, Stop Screen Saver, Wake Screen.

As a general rule you should try to avoid absolute screen coordinates in your macros whenever possible for exactly this reason.

Instead, use the SCREEN or SCREENVISIBLE functions. For example:

  • Move and resize SCREENVISIBLE(Second,Left,5%), SCREENVISIBLE(Second,Top,5%),SCREENVISIBLE(Second,Width)*90%, SCREENVISIBLE(Second,Height)*90%

That will make the window mostly fill the second screen (the “Second screen” is the the left-most non-Main screen, and the “Main screen” is the one with the menu bar on it in the Displays arrangement, the top left corner of which is the origin for the desktop space.

I am not following you. There is no Action with the name screenvisible. Your example points to some sort of script, but I am not understanding how or where to use this script. JavaScript, AppleScript .. what is it?

I searched help and, low and behold there are all sorts of functions in KM. But I have never used this part of KM and I am a bit clueless as to when to use them and - where to place them. I have only made use of Actions so far - or applescripts.

It is not an action, it is a Function.

Something like:

1 Like

I have to come back to this. I still don't get it. I tried changing the,
"SCREENVISIBLE(Main,Left)", to "SCREENVISIBLE(Right,Left)" thinking this was the way to address the right monitor, Of course this was incorrect as it just turned the text red as in an error was made.

I am not understanding something that used to work well when all my three monitors had the same resolution. Now that I have changed the main monitors resolution it is more of a problem than it used to be to get the windows to fill the monitors.

One fo the main challenges is watching a movie. I use VLC to watch movies a lot. Since not all movies are sized the same, I want to the VLC window to go to it's max size within a certain monitors window frame. And of course, I also move web pages and documents I am working on from window to window.

What I am not understanding is how size is being calculated. Some apps can do this perfectly which makes me think that in my use of KeyBoardMaestro I am still not understanding how to do this.

I have a little helper app, Cinch, that will fill the active screen with any window that is dragged against the top window boundary. Cinch seems to know what the windows boundaries are every time. If I could also get this from Keyboard Maestro I would be a happy man.

I have also learned that if I double click on a movie with VLC, it goes to full screen. Then, when I double click on the same window in full screen, the window changes from full screen to filling the window as it's max size will permit. Her again is something I wha trying to get my KeyboardMaestro macro to achieve.

Right now I am testing with "Zoom" at the end of the macro. But this zooms to a zoomed window (obviously) and I really do not want a zoomed window. I want the window that I send to a screen to go as far as it can inside that windows boundaries.

I am thinking, it would be very nice if there was a feature in KeyboardMaestro where I could point the macro to a window and it would just copy the windows dimensions. Then I could more easily resolve these challenges.

Perhaps it would help if you studied this wiki article:
SCREEN and SCREENVISIBLE functions

FWIW, I have used many, if not all, of the KM screen and window related functions and tokens, and have found all of them to work very well. Sometimes its takes a bit of experimentation to find the right solution. But it will definitely speed up your learning and development process if you will read and study the relevant KM Wiki articles, as well as examine some of the many screen related macros that have been posted.

Questions?

The SCREENVISIBLE function wiki documentation explains the two (optionally three) parameters.

The first one selects the screen. Screen 1 is the left-most screen, so:

SCREENVISIBLE(SCREENCOUNT(),Left)

Would be the left side of the right-most screen.

Assuming you make the window front-most, then the %WindowFrame%1% token will give you the coordinates.