Temporarily change the key command binding

I have a macro which makes the Enter to open the file or the folder

But it interferes with the Finder Rename function because now, if I do File/ Rename which I set to CMD+Enter, Enter doesn't confirm the renaming but enter the folder.

Is it possible to disable the Enter to open macro until I press the Enter or Escape? So the Enter will behave as earlier during renaming?

I think the best way to solve this is to combine the Open and Rename macros into one, because you can assign multiple triggers, and then detect which trigger was used and act accordingly. This seems to work on my Mac:

Download Macro(s): Open or rename.kmmacros (3.8 KB)

Macro screenshot

Macro notes
  • Macros are always disabled when imported into the Keyboard Maestro Editor.
    • The user must ensure the macro is enabled.
    • The user must also ensure the macro's parent macro-group is enabled.
System information
  • macOS 14.7
  • Keyboard Maestro v11.0.3

If you have other modifier-key actions on Return, just add them as additional cases before the otherwise. And note that %TriggerValue% returns graphics, not text. So Control is ⌃, Option is ⌥, and Shift is ⇧.

-rob.

2 Likes

Thank you! But it doesn't work as I need.
When I press command+enter it executes Rename but when I press enter after rename, it opens folder instead of confirming rename.

Ah, right, sorry. Try this version:

Download Macro(s): Open or rename [Finder].kmmacros (5.4 KB)

Macro screenshot

Macro notes
  • Macros are always disabled when imported into the Keyboard Maestro Editor.
    • The user must ensure the macro is enabled.
    • The user must also ensure the macro's parent macro-group is enabled.
System information
  • macOS 14.7
  • Keyboard Maestro v11.0.3

This checks to see if the Undo Typing menu item is active, which will only be the case (hopefully) if you've just renamed a file. If that's true, it just sends Return. Otherwise, it does File > Open.

If this doesn't work quite right, then the trick is going to be finding a condition that's only true (and checkable via KM) just after renaming a file.

-rob.

Great! I have only changed the Undo Typing to Cut as if I just activate rename I decided not to type anything, Enter executed Open

EDIT: it needs both Undo Typing and Cut options

@griffman I have just crossed with one more use case: Spotlight. I need it to send Enter also if Spotlight activated. May you help please?

EDIT: Currently I am using the Found Image condition. "Show More" Spotlight part

I think you're right—Found Image is probably the only way to deal with Spotlight, given that it's a floating window that doesn't really seem to exist. I added this as a condition for sending normal return:

image

-rob.

1 Like

Thanks! There are other cases when it fails but it's OK on 90% now.