Maximize Window When Dragging to the Top of the Screen (Also Left and Right Halves)

These are working pretty well for me on multiple screens. Adding the 1 second pause seems to clear up the "glitchy" behavior. All are looking for a drag to the top, and i set a 200 pixel "zone" on the left and right to do 1/2 screen window resize/move. Great idea @Nige_S and @iamdannywyatt



Window Maximize.kmmacros (10.7 KB)

...and

Interesting. 25 pixel menu bar was standard, but I guess in these days of Retina displays an scaling it would be better not to rely on it. Of course we're already using a function that puts the top of the window at the bottom of the menu bar -- I should have thought to use that earlier!

Try changing the condition in the first action to

CALCULATE(%FrontWindowFrame[2]% ≤ SCREENVISIBLE(Mouse,Top))

and the second "If" test to

MOUSEY < SCREENVISIBLE(Mouse,Top)

and that should make the macro behave better across different systems, settings, and external displays. Here's the altered version, also with @Evan_Mangiamele's added pause:

Window Maximise v2.kmmacros (5.1 KB)

That's a KM setting -- whichever Group the macro is in has got "Display in menu bar" turned on.

That sounds like you aren't releasing cleanly. If you keep the mouse button down and move the pointer to the left or right, then:

  1. The frontmost window has moved, triggering the macro
  2. The pointer is still in the menu bar, confirming that you want to resize the window
  3. So the window which you just moved a couple of pixels left (or right) is resized to maximum again (actually just moved back into place)

I'm guessing that's why @Evan_Mangiamele's pause is working for him, it gives some time for the mouse release.

1 Like

I haven't used this at all, because it was glitchy to me and I came up with this new macro. It seems to be working like a charm, but I would like to know if anyone here sees any issues with it that I'm not aware of?

I have the MOUSEY set to 30, because any other value below that would not work 100% of the time, for some reason. Also, the X and Y of the window is set to the screen size, even though the window will not be able to use all that space, just because I wanted to make sure it tries to use the maximum available space.

Maximize Window.kmmacros (22 KB)

I ended up creating 3 options with some slight changes to the one I just shared using SCREENVISIBLE:
Window - Maximize.kmmacros (20 KB)
Window - Left Half.kmmacros (20 KB)
Window - Right Half.kmmacros (20 KB)

Hey Danny,

I don't love the fact that this macro runs every time you move or resize a window, but I don't see it becoming an obvious problem.

Good job on getting it working.

-Chris

Thank you for the reply.

All solutions offered by the other users rely on that as well using the same trigger, so I guess that's the only way to achieve this?

Anyway, as I mentioned on some previous replies, this is not something I'm doing over and over again. I'm always working with maximized windows anyway.

Thanks :slight_smile: So far, I'm happy with how it works and it really emulates BTT.

Offhand I can't think of another method.