I'm having a problem with a Finder function that I'm not sure of the name of. For many years I've been able to cycle through each open window, in succession, with the shortcut cmd+tilde. I've recently discovered the Stage Manager, and want to continue using it but having that enabled defeats the cmd-tilde cycling.
I'd like to create a KM macro that will assign cmd-tilde to the Finder window-cycling function, but can't figure out what Action to use. I'm using Sequoia (15.5).
I don't have Stage Manager enabled, and the shortcut you mention doesn't work for me.
In any case, your question is interesting, and there is probably a solution with a KM macro containing AppleScript, but I'm not able to provide solutions using AppleScript.
It's just the shortcut assigned to the Finder's Window > Cycle Through Windows menu item. By default, on a US system, that's Command-Backtick (not Tilde, which would require a Shift, technically).
For me, with Stage Manager active, the shortcut works, though the final use of it winds up with the Stage Manger selected. @philxm, what do you see as the listed shortcut in the Cycle Through Window menu item?
When Stage Manager is active, ⌘` cycles through all the windows within each 'stage'. I wasn't able to find a satisfactory solution the last time I tried, which is just one of the many walls I hit and why ultimately I can't use Stage Manager even though I wish I could.
I thought I remembered there had been a keyboard shortcut to switched through the front application windows, but that it stopped at the end and required using shift to back in the other direction. I can't remember what that shortcut was and can't seem to find it online. Possibly this is how ⌘` used to work and has since been updated to cycle around. Ah yes, this was indeed the case.
I had never noticed the Cycle Through Windows menu item in Finder before. It shows the cmd-` shortcut, but it's greyed out. Surely there must be a KM action that addresses that menu item. Or, if not that, that can get the same function through a different approach. It's obviously very powerful, and I'd be surprised if this little matter can defeat it.
const
windows = Application("Finder").windows,
n = windows.length;
1 < n
? (
windows.at(n - 1).index = 1,
windows.at(0).name()
)
: "Less than two Finder windows open."
Have you considered writing a macro that selects the "next" window by opening the Finder's Window menu and choosing, using a rotating method, the "next" window. If you look there, you will see each existing window showing in that list (although there's probably a maximum number.) Considering trying that.
Here's some help. These two actions will fetch the names of all the Finder windows. You can use this information to rotate between the windows, perhaps by saving an index of which window was the last one activated by your macro.
The easiest way is to work "backwards", pulling the rear-most window to the front every time:
(The problem going the other way is that when you run the macro window 2 becomes window 1 and window 1 becomes 2 -- run it again and you are back where you started, instead of popping window 3.)
Not a Stage Manager user, but check that you haven't set this:
"One at a time" will prevent window cycling -- coz it only shows one window at a time! You need it to be "All at once".
If that's not it then you'll need to explain your setup a bit more -- a screen shot would help. Even if you split Finder across multiple Stages ⌘` should still do something, albeit that it will switch between windows and apps on the current Stage (it won't rotate through Finder windows on different Stages).
Using "window index -1" didn't do anything. I've found, however, that if I set the index number to equal the number of open Finder windows the macro will indeed cycle through them.
If I set it to that number plus one more, on the other hand, the macro does nothing again. Unless there's a way for KM to very quickly take a count of the number of open windows (and then enter that number into the box), then this approach seems impractical to me.
FYI I have "Show windows from an application" set to "All at once."
I've just updated my, previously working properly, test machine to 15.5 and yes -- Finder window cycling appears to broken in Stage Manager. Even the menu item doesn't work, so it isn't like the Shortcut is being overridden by something.
Working round this could be easy or tricky, depending on how you use your Stages. It seems (brief testing) that windows are indexed through Stages first and then by z-index on a Stage. So if you've Finder windows on multiple Stages it will be something like:
Current Stage Window 1 Window Index 1
Window 2 Window Index 2
Stage 1 in list Window 1 Window Index 3
Stage 2 in list Window 1 Window Index 4
That's probing with AppleScript -- KM may use a different API and get different results, so suck it and see.
There's also the problem that Stages change order as they are activated, which will of course change the indexes of the windows.
Don't forget to raise a bug report with Apple -- the best fix is at the source. The second best fix, I'm afraid, is to stop using Stage Manager...