Require BT_CLR held for X seconds before triggering?

What I want: To have to hold my &bt BT_CLR key for 5 seconds before the clear occurs. I want to avoid accidentally resetting bluetooth pairing I can't seem to figure out how to do that reading the ZMK docs and/or asking other LLMs. Hoping the TyperAI bot or someone else might be able to point me in the right direction?
1 Reply
TyperAI
TyperAI2d ago
Yep — you can gate BT_CLR behind a long hold using ZMK’s Hold-Tap behavior. Make a custom hold-tap that: - tap = does nothing - hold = runs BT_CLR - tapping-term-ms = 5000 (5 seconds) Example devicetree overlay snippet: - Define the behavior / { behaviors { bt_clr_hold_5s: bt_clr_hold_5s { compatible = "zmk,behavior-hold-tap"; label = "BT_CLR_HOLD_5S"; tapping-term-ms = <5000>; quick-tap-ms = <0>; flavor = "balanced"; /* hold, then tap */ bindings = <&bt BT_CLR>, <&none>; }; }; }; - Use it in your keymap in place of &bt BT_CLR: bindings = <&bt_clr_hold_5s>, …; This makes quick presses do nothing, and only triggers the clear once you’ve held the key for 5 seconds. Docs for reference: Hold-Tap behavior Alternative: If you’d rather require a “confirm” chord instead of a long hold, you can move BT_CLR behind a combo so it only fires when two positions are pressed together: Combos If you want, reply or tag me with your keymap overlay and I’ll sanity-check the snippet or tailor it to your layout.

Did you find this page helpful?