Tile *Previous* Window Side-by-Side with Current

I'm well aware of Moom, BetterTouchTool, BetterSnapTool, Divvy, and Spectacle, and have thoroughly read this question's answers.

I don't think any of the above can:

with one keyboard stroke, tile the current window and the previously-focused window side-by-side.

Moom allows application-specific configurations; all the others allow manipulating only the current-focused window.

This is something I find that I'm doing over and over again, for example: switching from a PDF to my browser to type some info from the PDF into my browser; I'd like to quickly show them side-by-side so that it's easy to copy over, say, an address.


Solution 1:

It can be done via AppleScript.

I might be able to fudge some kind of script for you in a day or so, but take a look at:

http://tom.scogland.com/blog/2013/06/08/mac-raise-window-by-title/
(mostly for how to make the script non-specific to an an application) and https://macosxautomation.com/applescript/firsttutorial/04.html
(for relative window indexes).

I don't unfortunately know the scripting terminology for placing windows side-by-side, so either someone else can take a crack at it, or I will in a couple days.