feat(behaviors): lazy sticky keys

This commit is contained in:
Theo Lemay
2023-05-28 23:59:48 -07:00
committed by Pete Johanson
parent 8929355ac0
commit 341534aa15
18 changed files with 260 additions and 32 deletions

View File

@@ -0,0 +1 @@
s/.*hid_listener_keycode_//p

View File

@@ -0,0 +1,4 @@
pressed: usage_page 0x07 keycode 0x04 implicit_mods 0x00 explicit_mods 0x00
released: usage_page 0x07 keycode 0x04 implicit_mods 0x00 explicit_mods 0x00
pressed: usage_page 0x07 keycode 0x04 implicit_mods 0x00 explicit_mods 0x00
released: usage_page 0x07 keycode 0x04 implicit_mods 0x00 explicit_mods 0x00

View File

@@ -0,0 +1,43 @@
#include <dt-bindings/zmk/keys.h>
#include <behaviors.dtsi>
#include <dt-bindings/zmk/kscan_mock.h>
/* this test ensures that lazy sticky keys don't emit anything on timeout */
&sk {
lazy;
release-after-ms = <50>;
};
/ {
keymap {
compatible = "zmk,keymap";
label ="Default keymap";
default_layer {
bindings = <
&sk LEFT_CONTROL &kp A
&sk LEFT_SHIFT &sk LEFT_ALT>;
};
};
};
&kscan {
events = <
/* tap sk LEFT_CONTROL */
ZMK_MOCK_PRESS(0,0,10)
ZMK_MOCK_RELEASE(0,0,10)
/* tap sk LEFT_SHIFT */
ZMK_MOCK_PRESS(1,0,10)
ZMK_MOCK_RELEASE(1,0,60)
/* tap sk LEFT_ALT */
ZMK_MOCK_PRESS(1,1,10)
ZMK_MOCK_RELEASE(1,1,60)
/* tap A */
ZMK_MOCK_PRESS(0,1,10)
ZMK_MOCK_RELEASE(0,1,10)
/* tap A */
ZMK_MOCK_PRESS(0,1,10)
ZMK_MOCK_RELEASE(0,1,10)
>;
};