Play a sound when a long press is detected

To launch various applications with shortcuts, I have set up shortcuts such as

"Option + C" tap: launch Chrome
"Option + C" long press: launch Safari

However, even if I release my finger thinking I've made a long press, there are cases where it isn't recognized as a long press and is still recognized as a tap.

Of course, it's fine if I hold down the key long enough, but since it's a shortcut I'll use hundreds of times, I don't like to keep long pressing it for any longer than necessary.

So I thought it would be good if there was a pop sound when it recognized that a long press had been made, so I'd know when to release my finger.

Is that possible?

I doubt it. It might be a feature that could be added to KM, but I doubt that too. But I see your point.

There is probably a way to change the duration of the long press. KM has some internal variables that might be able to address this. It sounds like you need a shorter duration. Hopefully someone can tell us both if that's a setting that we can change.

1 Like

Airy, Thank you for your reply. Oh yes, even if I can't make a sound, it would be very useful if I could change the long press time. Thank you.

There is a macOS command that can list dozens of KM's internal variables. Here's the command. Enter this command into a Terminal window. Perhaps one of them looks like the variable for the double click time.

defaults read com.stairways.keyboardmaestro.engine

To be honest, I don't see a variable that describes what you need. But I'm not expert at this. Maybe someone can tell us if there is one.

1 Like

Click here to see how to change the default timings for hot keys.

That page also lists all those other KM preferences, so you might like to bookmark it.

1 Like

Thanks tiffle. My method only listed a subset. At least I knew there was an answer.

1 Like

Nice to know my Multi-Press Macros still have some usefulness.

Here's an example caller that plays a sound as soon as a long-press has been detected, which isn't possible with the native long-press detection:

Short-Long Press with Beep.kmmacros (42 KB)

Macro screenshot

3 Likes

That command will only reveal defaults that have been set; it won't reveal defaults that can be set but are not currently set, i.e. hidden preferences. To find those, you have to use strings command on the binary itself, though I don't even know if that works any more.

I wrote about it ... OMG 16 years ago.

-rob.

1 Like

Thank you tiffle, I checked the webpage.

1 Like

Thank you noisneil, this macro seems to help me achieve my goal.

1 Like