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?
2 Replies
TyperAI
TyperAI3mo 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.
Pumpkin Escobar
Pumpkin EscobarOP2mo ago
The above was close. behavior:
bth: behavior_bth {
compatible = "zmk,behavior-hold-tap";
label = "BT_HOLD";
#binding-cells = <2>;
tapping-term-ms = <5000>;
quick-tap-ms = <0>;
flavor = "tap-preferred";
bindings = <&bt>, <&none>;
};
bth: behavior_bth {
compatible = "zmk,behavior-hold-tap";
label = "BT_HOLD";
#binding-cells = <2>;
tapping-term-ms = <5000>;
quick-tap-ms = <0>;
flavor = "tap-preferred";
bindings = <&bt>, <&none>;
};
used as &bth BT_CLR

Did you find this page helpful?