Make 'app close' shortcut apply to Finder/Trash, closing their windows when focused?

Hi there,

I've got a custom keybind (Shift+Comma) to send the Command+Q command to kill an app/close its window.

However, because Finder and Trash aren't kill-able, or closeable, this obviously doesn't work.

What I'd like is to be able to set up a condition that if a Finder, Trash or System window is focused, that same keybind (Shift+Comma) closes the window. It's just a handy way of removing clutter and I'd like to keep the same hotkey consistent across regular apps and non-killable apps.

Can anyone think of any conditions I can put in to basically say 'If the app can be killed, kill it. It it can't be killed, close the window?'

Any help would be greatly appreciated.

Thank you!

If application Finder is at the front
Then simulate command W
Else simulate command Q

Cool, that sounds awesome. So how would I actually implement that into Keyboard Maestro? I tried by Focused Window Trigger but can't find a way to implement what you've written out here

Create a macro with the hot key trigger of ⇧, and add an "If Then Else" action like so:

1 Like

And if you want to close the windows -- ⌘⌥W

1 Like

Thanks so much! Worked perfectly! You guys are the best

1 Like