This brings the 'global-quick-tap' functionality to combos by filtering out candidate combos that fell within their own quick tap term. I also replaced `return 0` with `return ZMK_EV_EVENT_BUBBLE` where appropriate. (I assume this was done in past as it is similar to errno returning, but being that this is to signify an event type I find this more clear)
64 lines
1.5 KiB
Text
64 lines
1.5 KiB
Text
#include <dt-bindings/zmk/keys.h>
|
|
#include <behaviors.dtsi>
|
|
#include <dt-bindings/zmk/kscan-mock.h>
|
|
|
|
/ {
|
|
combos {
|
|
compatible = "zmk,combos";
|
|
combo_one {
|
|
timeout-ms = <50>;
|
|
key-positions = <0 1>;
|
|
bindings = <&kp X>;
|
|
global-quick-tap-ms = <100>;
|
|
};
|
|
|
|
combo_two {
|
|
timeout-ms = <50>;
|
|
key-positions = <0 2>;
|
|
bindings = <&kp Y>;
|
|
};
|
|
};
|
|
|
|
keymap {
|
|
compatible = "zmk,keymap";
|
|
label ="Default keymap";
|
|
|
|
default_layer {
|
|
bindings = <
|
|
&kp A &kp B
|
|
&kp C &kp D
|
|
>;
|
|
};
|
|
};
|
|
};
|
|
|
|
&kscan {
|
|
events = <
|
|
/* Tap A */
|
|
ZMK_MOCK_PRESS(0,0,10)
|
|
ZMK_MOCK_RELEASE(0,0,60)
|
|
/* Quick Tap A and B */
|
|
ZMK_MOCK_PRESS(0,0,10)
|
|
ZMK_MOCK_PRESS(0,1,10)
|
|
ZMK_MOCK_RELEASE(0,0,10)
|
|
ZMK_MOCK_RELEASE(0,1,200)
|
|
/* Combo One */
|
|
ZMK_MOCK_PRESS(0,0,10)
|
|
ZMK_MOCK_PRESS(0,1,10)
|
|
ZMK_MOCK_RELEASE(0,0,10)
|
|
ZMK_MOCK_RELEASE(0,1,10)
|
|
/* Combo One Again (shouldn't quick tap) */
|
|
ZMK_MOCK_PRESS(0,0,10)
|
|
ZMK_MOCK_PRESS(0,1,10)
|
|
ZMK_MOCK_RELEASE(0,0,10)
|
|
ZMK_MOCK_RELEASE(0,1,10)
|
|
/* Tap A */
|
|
ZMK_MOCK_PRESS(0,0,10)
|
|
ZMK_MOCK_RELEASE(0,0,60)
|
|
/* Combo 2 */
|
|
ZMK_MOCK_PRESS(0,0,10)
|
|
ZMK_MOCK_PRESS(1,0,10)
|
|
ZMK_MOCK_RELEASE(0,0,10)
|
|
ZMK_MOCK_RELEASE(1,0,10)
|
|
>;
|
|
};
|