How to set up a repeating action whilst keys are held down

Hi. A total newbie here. I’ve got KM6 to give my MacBook laptop a FWD DEL key (by setting up “alt-delete” as the triggering macro) which works fine. I’d like it however to keep on forward deleting as long as I keep the both macro keys pressed, like the System Preferences “Keyboard Repeat” function, but I can’t seem to work out how to do it correctly. Any ideas? Many thanks!

Hello @jada

<FN><delete> should perform forward-delete on a MacBook Pro.

In Keyboard Maestro key-repeat is active when the ‘is down’ hotkey trigger is selected.

Best Regards,

Many thanks Chris, just what I was looking for! I knew about the “fn-delete” but that’s always been a two-handed job and I was hoping to also use it single-handed. Now I can, using “alt-delete” and your tip. Thanks again!

For what it is worth to anyone searching the forum, you can do something like this.

1 Like

That is a good solution. You can adjust the hot key trigger to “while down” and then it will re-trigger repeatedly while the hot key is held down (at the same delay and then rate as a normal key repeat). But your solution gives you more direct control over the timing of the behaviour.

Thanks Peter for the added note, just to be certain since Keyboard Maestro defaults to a 0 delay then it follows the System Preferences: Keyboard: Key Repeat setting even when modifiers are held down?

You can set the delay to wait after simulating a keystroke before continuing to the next action (default 0.0)
defaults write com.stairways.keyboardmaestro.engine SimulateKeystrokeDelay -float 0.01

If you change this to a 1 second delay I am assuming that is added to the delay set in System Preferences + the pause for .04 in the example above.

Also I am a little unclear about this setting if the command key if it is used as a modifier.

If the command key is down, the delay is stored in the SimulateKeystrokeCommandKeyDelay preference (default 0.15)
defaults write com.stairways.keyboardmaestro.engine SimulateKeystrokeCommandKeyDelay -float 0.15

It kind of sounds like there is an additional .15 delay added if the command key is used as part of the key trigger.

1 Like

No, you’re talking cross-purposes.

The preferences you mention are about the delay Keyboard Maestro waits after simulating a keystroke.

The trigger repeatedly triggers the macro at a period based on the System key repeat Preferences.

Thank you for the clarification Peter

Just wanted to say, this helped a random person in rural Japan. As usual, I need look no further than KM to solve my problems!


Keyboard Maestro is person/country agnostic. It seeks to help all of us, no matter where we are, as long as we use a Mac.