forked from kofal.net/zmk
fix(behaviors): Make multiple sticky keys work on same key position (#2758)
test(behaviors): Add same position sticky key tests fix(behaviors): Make multiple sticky keys work on same key position refactor(behaviors): Remove unused param2 in sticky keys
This commit is contained in:
1
app/tests/sticky-keys/12-macro/events.patterns
Normal file
1
app/tests/sticky-keys/12-macro/events.patterns
Normal file
@@ -0,0 +1 @@
|
||||
s/.*hid_listener_keycode_//p
|
||||
4
app/tests/sticky-keys/12-macro/keycode_events.snapshot
Normal file
4
app/tests/sticky-keys/12-macro/keycode_events.snapshot
Normal file
@@ -0,0 +1,4 @@
|
||||
pressed: usage_page 0x07 keycode 0xE0 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
|
||||
released: usage_page 0x07 keycode 0xE0 implicit_mods 0x00 explicit_mods 0x00
|
||||
36
app/tests/sticky-keys/12-macro/native_posix_64.keymap
Normal file
36
app/tests/sticky-keys/12-macro/native_posix_64.keymap
Normal file
@@ -0,0 +1,36 @@
|
||||
#include <dt-bindings/zmk/keys.h>
|
||||
#include <behaviors.dtsi>
|
||||
#include <dt-bindings/zmk/kscan_mock.h>
|
||||
|
||||
/ {
|
||||
behaviors {
|
||||
ZMK_MACRO(sk_sl, wait-ms = <1>; tap-ms = <1>; bindings = <&sk LEFT_CONTROL &sl 1>;)
|
||||
};
|
||||
|
||||
keymap {
|
||||
compatible = "zmk,keymap";
|
||||
|
||||
default_layer {
|
||||
bindings = <
|
||||
&sk_sl &mo 1
|
||||
&kp Y &kp B>;
|
||||
};
|
||||
|
||||
upper_layer {
|
||||
bindings = <
|
||||
&kp T &kp X
|
||||
&kp A &kp Z>;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
&kscan {
|
||||
events = <
|
||||
/* tap sk_sl */
|
||||
ZMK_MOCK_PRESS(0,0,10)
|
||||
ZMK_MOCK_RELEASE(0,0,10)
|
||||
/* tap A */
|
||||
ZMK_MOCK_PRESS(1,0,10)
|
||||
ZMK_MOCK_RELEASE(1,0,10)
|
||||
>;
|
||||
};
|
||||
@@ -0,0 +1 @@
|
||||
s/.*hid_listener_keycode_//p
|
||||
@@ -0,0 +1,6 @@
|
||||
pressed: usage_page 0x07 keycode 0xE0 implicit_mods 0x00 explicit_mods 0x00
|
||||
pressed: usage_page 0x07 keycode 0xE1 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
|
||||
released: usage_page 0x07 keycode 0xE0 implicit_mods 0x00 explicit_mods 0x00
|
||||
released: usage_page 0x07 keycode 0xE1 implicit_mods 0x00 explicit_mods 0x00
|
||||
@@ -0,0 +1,39 @@
|
||||
#include <dt-bindings/zmk/keys.h>
|
||||
#include <behaviors.dtsi>
|
||||
#include <dt-bindings/zmk/kscan_mock.h>
|
||||
|
||||
/ {
|
||||
keymap {
|
||||
compatible = "zmk,keymap";
|
||||
|
||||
default_layer {
|
||||
bindings = <
|
||||
&sk LEFT_CONTROL &mo 1
|
||||
&kp A &kp B>;
|
||||
};
|
||||
|
||||
lower_layer {
|
||||
bindings = <
|
||||
&sk LEFT_SHIFT &kp X
|
||||
&kp Y &kp Z>;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
&kscan {
|
||||
events = <
|
||||
/* tap sk LEFT_CONTROL */
|
||||
ZMK_MOCK_PRESS(0,0,10)
|
||||
ZMK_MOCK_RELEASE(0,0,10)
|
||||
/* switch to lower layer */
|
||||
ZMK_MOCK_PRESS(0,1,10)
|
||||
/* tap sk LEFT_SHIFT */
|
||||
ZMK_MOCK_PRESS(0,0,10)
|
||||
ZMK_MOCK_RELEASE(0,0,10)
|
||||
/* deactivate lower layer */
|
||||
ZMK_MOCK_RELEASE(0,1,10)
|
||||
/* tap A */
|
||||
ZMK_MOCK_PRESS(1,0,10)
|
||||
ZMK_MOCK_RELEASE(1,0,10)
|
||||
>;
|
||||
};
|
||||
@@ -0,0 +1 @@
|
||||
s/.*hid_listener_keycode_//p
|
||||
@@ -0,0 +1,4 @@
|
||||
pressed: usage_page 0x07 keycode 0xE0 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
|
||||
released: usage_page 0x07 keycode 0xE0 implicit_mods 0x00 explicit_mods 0x00
|
||||
@@ -0,0 +1,45 @@
|
||||
#include <dt-bindings/zmk/keys.h>
|
||||
#include <behaviors.dtsi>
|
||||
#include <dt-bindings/zmk/kscan_mock.h>
|
||||
|
||||
/ {
|
||||
keymap {
|
||||
compatible = "zmk,keymap";
|
||||
|
||||
default_layer {
|
||||
bindings = <
|
||||
&sk LEFT_CONTROL &mo 1
|
||||
&kp A &kp B>;
|
||||
};
|
||||
|
||||
lower_layer {
|
||||
bindings = <
|
||||
&sl 2 &kp X
|
||||
&kp Y &kp Z>;
|
||||
};
|
||||
|
||||
upper_layer {
|
||||
bindings = <
|
||||
&kp T &kp X
|
||||
&kp A &kp Z>;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
&kscan {
|
||||
events = <
|
||||
/* tap sk LEFT_CONTROL */
|
||||
ZMK_MOCK_PRESS(0,0,10)
|
||||
ZMK_MOCK_RELEASE(0,0,10)
|
||||
/* switch to lower layer */
|
||||
ZMK_MOCK_PRESS(0,1,10)
|
||||
/* tap sl upper_layer */
|
||||
ZMK_MOCK_PRESS(0,0,10)
|
||||
ZMK_MOCK_RELEASE(0,0,10)
|
||||
/* tap A */
|
||||
ZMK_MOCK_PRESS(1,0,10)
|
||||
ZMK_MOCK_RELEASE(1,0,10)
|
||||
/* deactivate lower layer */
|
||||
ZMK_MOCK_RELEASE(0,1,10)
|
||||
>;
|
||||
};
|
||||
Reference in New Issue
Block a user