Bring Application Finder Windows to Front

Here is a really useful macro, first suggested to me by Adam Engst - basically, every time the Finder activates, it brings all the Finder windows to the front. Once you've used this macro, you'll find it hard to use a Mac that doesn't do this!

Bring Application Finder Windows to Front.kmmacros (3.1 KB)

4 Likes

Thanks Peter, have downloaded it, it's running and I may wind up appreciating it like you do. It may wind up replacing the macro I normally use for switching to the Finder:

with the ⌄⌘H keystroke not only putting the windows of other applications in the background but disappearing them completely. I've deleted this keystroke from my present version of the macro and will try it without for a while.

I have a couple of questions about this macro as I strive to become a better KM user.

What is the purpose of the conditional? Since the macro is triggered by the Finder activating, won’t the Finder always be at the front? Or can it activate without coming to the front?

Is bringing all the Finder windows to the front by selecting the menu item preferable to the KM Bring Application Windows to Front built-in action?

There are occasions where the Finder (or any application really) can come to the front (activate) and then immediately deactivate. The most obvious and pertinent example of this would be if the Select Menu Item action triggered a menu in the Finder - the net effect of that is to activate the Finder, select the menu, and then switch back to the last application.

Now the problem happens if the Finder activates, and then deactivates, and then the Select Menu Item action executes, and that activates the Finder, selects the menu, and then switches back. But that second activation triggers the macro a second time, so the process repeats. Indefinitely. Which is not good at all. The conditional defends against this case.

Actually, I have no idea why I used the menu instead of the action. One down side of the action would happen in exactly the above case - it would bring the windows of the second application to the front instead of the Finder.

Then I will retain the conditional in my implementation of the macro. Thanks. You’re right, it is a very useful macro.

O
 M
 G
! Soooo glad I came across this. Awesome!!!

1 Like

I"m very late to the table on this topic, but if The Finder is the app that is in focus (front),
why would you want other windows to replace it, making the Finder not in focus?

Hey Tony,

You're misunderstanding what the macro does.

Reread Peter's post and/or try it out.

The macOS for decades has allowed an application to become frontmost by clicking on a window visible in the background with the mouse, but sometime after OSX came along when windows from other applications obscure that app's windows other than the one clicked they remain obscured.

The old MacOS' behavior was to automatically bring all application-specific windows to the front when that app was activated.

Peter's macro recreates this behavior and makes certain all Finder windows become visible when the user switches to the Finder, and this method may be used with all apps that support multiple windows (that I know of).

-Chris

I agree, and here's why

basically, every time the Finder activates, it brings all the windows to the front.

I took that as bring ALL windows to the front, except Finder. Now I know he is referring to Finder windows only, even though he didn't state it that way.

I have edited the post to explicitly say “all the Finder windows”.

Thanks for the feedback.

1 Like

Late to the party - but this is exactly the kind of stuff that is so useful and something you didn't know you needed until you have it.

Thanks!!

1 Like

For me this only works when the Keyboard Maestro Editor is open. What have I missed?

No idea. Macros don't require the editor to be open, so presumably something else is going on. Try using the Interactive Help to determine why the macro is not firing when you are in the Finder. Or add a Status Menu trigger to the macro and see if it is available when you are in the Finder.

I just quit the editor and must have been a bit confused before.

It seems to work correctly on my intel iMac but on my MacBook Pro silicon it only brings the finder windows forward on one of my screen. Seems a bit random which of my three monitors (each with Finder windows) will be the one to have its finder window brought forward. Still this is Better than the macOS default. I am definitely a noob with keyboard maestro but I'll try out your suggestions. Thanks Peter

I take that back. It works perfectly on silicon if Keyboard Maestro.app is running.

The behaviour really should be at all different whether the Keyboard Maestro.app (editor) is running or not.