Does anyone have a cool macro for swapping windows?

I use Moom as my Window Manager of choice, but it has no way of swapping windows. Swapping means if you have two apps that are side-by-side, you can click a Keyboard shortcut and have them swap locations. This is very common with tiling window managers. Some tiling window managers I've tried, but they also have their own drawbacks which brought me back to Moom.

I was wondering if anyone had a cool macro that can do this type of action?

As part of the Moom team, thanks for using our app :).

Swapping windows can seem conceptually simple, but implementing it is tricky: Do you only ever swap windows that each take up exactly half the display? What if it's not exactly 50/50? Where do you cut off the limit on "swappability?"

Or do you want to be able to somehow select any two arbitrary windows and swap them? In that case, you need to somehow mark Window1 and WIndow2 so that Moom (or the macro) knows what to swap.

Or is it only if two windows top edges line up exactly, regardless of their vertical size?

There are also possible issues with apps and minimum window sizes: You wouldn't be able to swap a Mail window into a small Notes window location, due to Mail's minimum window size.

Writing a macro might be possible, but it'd take a better understanding of the rules under which you'd like to enable window swapping. Such a feature might come to Moom, but it'd be no earlier than Moom 4, which is under development but has not ETA.


Nothing cool, but, subject to the limitations pointed out by @griffman (XY position is generally swappable, size can be partly out of reach with some apps) there is a rough draft of something here: