Odd Behavior While Centering Using Move and Resize Front Window

I'm trying to use the Move and Resize Front Window Action to resize and center the front window of any application using the following:

This works fine when the window is on the Main (center of six) display(s); however, if executed on the left screen, the window ends up centered between left and center screens; when used on the right screen, the window resizes itself for that screen, but then leaps over to the center screen, usually somewhere in the lower left quadrant..

When trying to use it un the upper screens, it leaps all over the place, (sometimes changing position as many as 3-4 times), and will randomly land in between screens, entirely off screen, or occasionally jump around until it lands on the center main screen.

No doubt I could simple hard code this, but it seems like the basic SCREENVISIBLE() should work on any screen, not just the main.

[aside]
FWIW, the stock Fill Left/Right actions work as expected on any screen (though not-infrequently, right-fill fails to resize properly, and leaves some portion of the window stretched over the right and lower edges); also, certain application windows fail to respect the Dock when on the left-edge of the screen, positioning the window edge under the Dock, blocking scrollbars. [/aside]

Suggestions?

Try this. It works for me with 2 external monitors.

Perfect. Much appreciated.

The function SCREENVISIBLE(x,MidX) is returning the horizontal middle of the selected display relative to the top left corner of the main display. So multiplying that by 50% is unlikely to be helpful. That would give you the point that is half way between the left edge of the main display and the middle of the selected display.

You can use any of these:

SCREENVISIBLE(Front,Left) + 25% * SCREENVISIBLE(Front,Width)
SCREENVISIBLE(Front,MidX) - 25% * SCREENVISIBLE(Front,Width)
SCREENVISIBLE(Front,Right) - 75% * SCREENVISIBLE(Front,Width)
SCREENVISIBLE(Front,Left,25%)
SCREENVISIBLE(Front,MidX,-25%)
SCREENVISIBLE(Front,Right,-75%)

Amazing! Peter, I do believe you have thought of just about everything, and then a lot that will never occur to us (or at least to me).

This is a very elegant solution. :+1:
Thanks for sharing these other options with us.

1 Like