Press and hold keystroke remap fails (e.g., Ctrl+Left/Right arrow remap to Opt+Left/Right)

I am attempting to migrate from Karabiner Elements which has stopped working for me.

I have most of my key remaps working, however, the Ctrl+Left/Right arrow keys are not fully working. They work for a single press, but not and hold. When I "press and hold" Ctrl+Left or Right, the first execution happens properly (my cursor moves one word to the left) but the next interaction is a regular Ctrl+Left (jumps to the beginning of the line). If I disable KM and use the built in Opt+Left arrow with a hold and press, it works the way you'd expect: each natural key repeat jumps the cursor one word to the left.

This happens to other similar hotkeys like Ctrl+Backspace

What I've tried:

  1. Use "is pressed" with "press and release" (the default)
  2. Use "is down" with "press and hold"
  3. Use "is down" with "press and repeat"
  4. Use "is pressed" with "press and hold" with a 100ms delay and then a "release"

Mm, interesting, I can reproduce this. It only affects the arrow keys. Ctrl + another key works as expected.

This is how it works eg with Ctrl + l

Sorry, I'm not helping you. I'm just confirming what you already know. :man_shrugging:

I appreciate the confirmation :slight_smile:

Do I understand what you're going for correctly?

You want to hold ⌃L and have the text cursor repeatedly jump back a word at a time, as though you were pressing ⌥←?

If so, this does that:

Jump Back a Word (Repeat).kmmacros (26 KB)

Macro screenshot

(Using the Repeat template, found here.)

Thank you for this. I will have a look at it. Why are there mouse position things in it?

To be clear, I want to use Ctrl+Left/Right arrows. Frank was just using his example.

It's part of the template. You can (optionally) return the mouse to it's starting position when the key is released, which may be desirable under certain circumstances.

You just need to change the trigger and simulated keystroke.

Oi - that did not work at all the way I wanted.

Here is what I want in very simple terms (let's just use the "jump back" and forget about the "jump forward" since it's the same thing): I want ⌃← to behave just like ⌥← does (natively).

Here's the same thing but with more detail:

  1. I depress ⌃← and quickly let go: text cursor jump back one word
  2. I depress ⌃← and let go after X seconds: text cursor jumps back the number of times that the OS would have repeated it based on my keyboard repeat rate settings.
  3. There should be no extra movement of the cursor after I release ⌃←

The Jump Back a Word (Repeat).kmmacros attachment did not work:

  1. I jumped back one word and then all the way to the beginning of the line (same problem as originally)
  2. However, in addition, there were a ton of repeated jumps that happened after I let go of the keyboard. It kept going for over 30 seconds and I was forced to very quickly close KM because I couldn't get it to stop.

What I can contribute: I tried to set up the shortcut with BTT to see if this is a pure KM problem.

It isn't. BTT produces exactly the same error. After two or three times, the cursor no longer jumps from word to word, but does whatever.

If KM and BTT produce the same error, then the problem seems to be elsewhere. Maybe at Apple?

Is it unthinkable for you to use the original shortcut? Opt + arrow keys?

1 Like

Works for me. As @Frankb says, it sounds like you have other problems at play.

I had this working perfectly with Karabiner Elements before the Ventura upgrade. It appears that some thing is in the way of Karabiner talking with its driver.

What is BTT?

I'm more or less guessing, but as far as I know Karabiner works on a deeper level than KM or BTT (BetterTouchTool). That would explain why with Karabiner works what fails with other software. But as I said, I'm just guessing. :man_shrugging:

One more thing: If the same shortcut is set up in KM and BTT, then the BTT action is always triggered. (KM is ignored). From this I conclude that BTT intervenes earlier than KM. Therefore I wanted to see how BTT deals with this problem.

Yeah, that response makes sense to me, @Frankb . Did you try @noisneil 's key repeat file by importing it? Did it do the same thing for you as it did for me? Or just the simple keystroke remap that I provided originally?

@noisneil , the macro you provided looks like it has a mandatory 0.3s delay between repeats. I don't see how that can possibly replicate the OS's native key repeat rate, but maybe it's close for you.

Are you saying that the simple key remap I provided originally should work the way I want it to? Or that the complex one should?

Nothing mandatory about it. It's there as a way for the user to determine the repeat-rate. Feel free to adjust or disable it.

I suggested the Repeat approach because it seemed like a functional workaround.

I'm not saying either. I just tried to help with an alternative approach, but evidently I wasn't successful. Hope you figure it out.

2 Likes

I am confused a bit. Does the simple key remap work for you the way I described I want it to work for me?

Holding a Keyboard Maestro trigger does not cause it to repeat in the same way that a direct system hotkey does, hence my workaround.

If you want to use ⌃← and ⌃→ as hotkey triggers for this, you will have to change or disable these Mission Control hotkeys, which will otherwise override Keyboard Maestro's trigger function: