Simply drag a number of related windows together
EDIT: actually it seems possible to make it "autohide". But it won't let me have more than one window visible at once!
It’s kind of buggy at times though.
I have a stage with a few terminals, vscode, and a development browser
On Windows, there is a nicely and predictably maintained Z-order, whereas MacOS insists that if I want to switch focus, surely I want all the windows that the other app has to offer, which feels like a big "mishmash" to me.
This had not been the case. Command tabbing would bring forward only the last active window. It was very handy to switch back and forth between text editor and browser that way. But then, they decided command tab should bring forward all windows, which ruined usability for me. Now I use BetterTouchTool [0] to directly switch to an app. Doing so brings forward only the last active window.
First, add a new keyboard shortcut trigger for “All Apps”. Choose a key combo that you prefer. I'm using a programmable keyboard that has a dedicated key corresponding to key combo CTRL+SHIFT+OPTION+CMD (a.k.a. super), which doesn't collide with system key combos. You are free to choose anything that suits you. For instance, to switch to Safari, I hit SUPER+S.
For corresponding action, choose “Launch Application / Open File / ...” and choose Safari from the box below. When Safari is already running, this action will switch focus to Safari's most recently focused window and will not bring other windows of it to foreground.
That's all. Set up other key combos for other applications as well. I have many set up. SUPER+T is for Terminal, SUPER+E is for Emacs. Switching between most recent windows of these apps should now be very easy and fast.