Apologies if this has already been shared, but in most apps, command-` (the tilde key) will rotate between windows of the same app. So this is an easy partial solution if you are only toggling between windows of the same app.
And ⌘⇥ will let you toggle apps, but brings all the app's windows to the front.
Unfortunately, "Activate Last Application" brings all the last app's windows to the front.
We're trying to replicate a BTT command which allows you to toggle between the two frontmost windows, regardless of whether they are of the same or different apps, without raising any other windows, and using a single hot key for both one-app and two-app situations so we don't have to think.
Sample use case: I've always got 2 or more FileMaker windows open, and a whole bunch of Safari windows. When on-boarding new staff the workflow includes repeatedly swapping between one of those FileMaker windows and one of those Safari windows. The macro lets me do that, always keeping both those windows in front of everything else.
Maybe this means he wants to implement this in the future.
If you are serious about the constantly recurring question: How to make KM easier for beginners? Then this would be a small start. One click, instead of a macro with 50 parts.
Totally agree. But sometimes you have to work with what you've got -- while asking for something better. Whether that be "Activate Last Application... but only window x", adding the ability to use variables/tokens in all actions where you can pick an app, both of those, or something better... Who knows?
Adding an option for every location that references an application to allow a variable selection of the application would be an awful lot of UI, enough to make it virtually impractical.
For activating an application, the Use Variable action has an option to activate an application by name.
Not sure I understand. It's about activating the "last front app" and from this app only the "last front window". The last front app can't be activated by name because it can be any app. If I want to activate an app by name, there are many possibilities.
I knew I was missing something. And that action only brings the frontmost window of the app to the front, leaving any others behind the previously frontmost window. So:
Here's another spin that's really simple, but does have a possible pitfall: if app A has two or more windows and is frontmost and app B is side-by-side, the macro will always favor the second window of the frontmost application (even if the focus has most recently alternated between app B and app A.)
I can live with this shortcoming, because I always use a quick tap of ⌘-Tab to toggle between two apps.
Which, unfortunately, brings all the windows of the newly-activated app to the front, potentially covering the window you've toggled from.
I'm starting to think I'm the only person who uses multiple windows in multiple apps and wants to toggle between two windows of two apps and keep both visible!
App windows open on other Desktop Space or app windows that are minimized are not brought up and, moreover, are not in the rotation when using the macro I shared.
You could move the subset of windows of interest to a separate Desktop Space and do just that without disrupting the other app windows.
Never use them. Partly because of the incomplete implementation, partly because I've never spent enough time trying them, partly because I don't compartmentalise in that way, partly because maintaining the same same Spaces setup across multiple machines is a pain.
But mainly, I suspect, because my primary machines have been 27-inch iMacs for the last dozen years!
There's also the fact that every user of Spaces that I go to help at work is clueless, and spends far longer trying to find the Space they want to use than they would ever spend simply bringing the right windows to the front of a single space I daresay that seeing a pro like you using them properly would change my opinion a lot!
Thank you all for figuring this out and creating a macro for it.
I used to use AltTab, a free app that does the same thing. But I will be using this macro moving forward.