Avoid text fields for one-key shortcuts when "Select Menu Item" action

I like single key shortcuts like in Photoshop. I have "r" for a Ruler tool that is turned on using action "Select Menu Item". The problem is, that I can't type "r" (only R with the Shift key) when in a text field. Any way around it?

Not really. It is hard to determine whether you are in a text field or not.

You can put such macros in a macro group and then have them toggled on and off with a hot key, and then manually toggle them off while typing and back on when you're done, but doing that automatically is not generally possible.

1 Like

A kind of workaround if you want to use a single key trigger (r) is short/long press. But this also has disadvantages.

There are also apps (BTT) that can detect the field the cursor is in. So you can set up conditional activations of different actions. If the cursor is in this field, then do this, otherwise do that. Unfortunately this is not completely reliable.

The best is still a real shortcut, modifier plus letter. :slightly_smiling_face:

1 Like

This is why Keyboard Maestro does not offer this facility - in theory, accessibility could tell you where the text focus is, but in practice, at least in all my tests, it is highly unreliable.

1 Like

Or

That's a matter of judgment. The reliability depends on the app and the intended use.

Let's take the Finder as an example. There is only one field in which you can write/type to set the name of a file (AXTextField). This field is recognized reliably. In the "list fields" letters cause that you can jump to a file with the respective initial letter. But many users do not use this. Therefore all letters are simply dead, if the cursor is not in AXTextField.

Alternatively letters could do what the user wants. So:

  • If the cursor is in "AXTextField", a = a, b = b, etc.
  • If the cursor is not in "AXTextField", a = something, etc. (instead of jumping around wildly)

In the Finder this works fine. But I admit, this is not the most important thing in life. :grinning:

That's not actually true, but leaving aside that, how do you determine if the cursor is in an AXTextField? That is the part that is unreliable.

BTT shows it to me when I move the cursor into a field.

image

Mm, no, not in the Finder. But who programmed it says: However not all apps label their textfields correctly, thus BTT can't know when a text field or text area is active (especially in cross platform apps). Also sometimes macOS doesn't update the focused element role fast enough.