Tap-hold keys that do not misfire

The layout above is my Corne: a wireless, Bluetooth build from Typeractive, with 42 keys and a small display on each half. It runs ZMK, and this post is about one part of its keymap: keys that do two jobs.

One key, two jobs

A tap-hold key sends one thing when tapped and another when held. On a 42-key board that is how the modifiers fit at all.

The risk is a misfire. Type quickly, overlap two keys by a few milliseconds, and the keyboard can read a tap as a hold. You get a shortcut you did not ask for, in place of the letter you typed.

Where my modifiers live

The popular version of this idea puts the modifiers under A S D F and J K L ;, and calls them home-row mods. I do not do that. Those are the keys I roll across fastest, which is where misfires come from.

Mine sit on the outer pinky columns and one key on the home row:

Key, when tapped When held
Tab Right Alt
Backtick Left Ctrl
Escape Left Alt
Semicolon Right Ctrl
Quote Left Cmd
Slash Hyper

Hyper is all four modifiers at once, which gives me a whole layer of shortcuts no app is already using.

Shift is different again. Both Shift keys are sticky: tap one, and the next key is capitalised, with nothing held down.

The settings that matter

ZMK has four settings that decide whether a press is a tap or a hold. These are mine for the pinky keys:

&mt {
    tapping-term-ms = <200>;
    flavor = "tap-preferred";
    quick-tap-ms = <180>;
    require-prior-idle-ms = <100>;
    retro-tap;
};
  • tap-preferred: a press only becomes a hold once the timer runs out. Pressing another key in the meantime does not turn it into a modifier.
  • tapping-term-ms: how long a press has to last before it counts as a hold. Mine is 200 milliseconds.
  • require-prior-idle-ms: if I pressed any other key within the last 100 milliseconds, this press is a tap, no questions asked. This is the setting that fixes fast typing.
  • quick-tap-ms: tap a key and press it again within 180 milliseconds, and the second press repeats the tap. Without it, holding Backspace-style repeats on a tap-hold key would not work.
  • retro-tap: hold a key, press nothing else, and release it, and it still sends the tap. A slow, deliberate press is not swallowed.

Different fingers, different timing

Not every finger moves at the same speed, so one set of numbers does not fit them all.

Used for Hold time Idle window
Thumb keys 180 ms 50 ms
Pinky keys 200 ms 100 ms

Thumbs are quick and deliberate, so they get a shorter hold time. Pinkies are slower and less precise, so they get more margin on both.

What I would tune first

If a tap-hold setup is misfiring, I would change things in this order:

  1. Switch to tap-preferred.
  2. Add require-prior-idle-ms, starting around 100.
  3. Only then adjust the hold time, in steps of 10 or 20.

Most of my misfires went away at step two.

The same keymap everywhere

These settings are habits as much as numbers, so they have to be the same on every board. My other keyboards carry the same values, and the laptop keyboard copies the layout through kanata. Mirroring a change across all of them by hand is the price of that.

Current theme

robot-reading-5k

Copied automatically from my desktop colorscheme, once a week. Dark mode uses these values as they are; light mode keeps each hue and flips the lightness.

RoleSchemeOn this page now
BackgroundPage background#0e0f17
SurfaceTiles and cards#181921
LineBorders and dividers#2a2c3d
TextBody text#cebead
AccentPrimary button and logo mark#e6d0ba
How this works