That was a standard capability of fvwm2, back when I used it as my windowing system on Linux. It has roughly similar sophistication to the default MS window manager, plus nifty features like that.

Nowadays I use KDE, and miss that fancy function very much! Though it does have "Pack Grow Window horizontally/vertically" functions, which do almost the same thing.

Cheers