Skip to content

Commit

Permalink
feat(mouse): mouse auto-layer다시 추가
Browse files Browse the repository at this point in the history
트랙패드 이동시 자동으로 마우스 레이어로 동작
마우스레이어와 기본레이어에서 R키홀드시 수직 스크롤
마우스레이어와 기본레이어에서 E키홀드시 수평 스크롤
마우스 레이어는 800ms 동안 활성화 되며 더 즉시 비활성화 하고자 하는경우 d+f키 콤보를 누르면 됨
  • Loading branch information
lazy-dinosaur committed Nov 12, 2024
1 parent 00fb440 commit eaa3998
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 20 deletions.
2 changes: 2 additions & 0 deletions boards/shields/lazycorne/lazycorne_dongle.conf
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,5 @@ CONFIG_I2C=y
CONFIG_INPUT=y
CONFIG_ZMK_MOUSE=y
CONFIG_INPUT_PINNACLE=y

# CONFIG_ZMK_USB_LOGGING=y
1 change: 1 addition & 0 deletions boards/shields/lazycorne/lazycorne_dongle.overlay
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
/ {
chosen {
zmk,kscan = &mock_kscan;
//zephyr,console = &cdc_acm_uart;
};

mock_kscan: kscan_1 {
Expand Down
10 changes: 6 additions & 4 deletions config/combos.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
//#define HRC_TAB &hml LS(LALT) TAB
#define HRC_REPEAT &hml_repeat LS(LCTRL) 0
#define HRC_CANCEL &hml LS(LCTRL) K_CANCEL
#define HRC_DEF &hml_def LS(LCTRL) 0
#define HRC_LPAR &hmr_lpar_lt RS(LCTRL) 0
#define HRC_RPAR &hmr_rpar_gt RS(LALT) 0

Expand All @@ -34,13 +35,14 @@
// ZMK_COMBO(ret, &kp RETURN, LT2 LT1, DEF NAV NUM, COMBO_TERM_FAST, COMBO_IDLE_FAST)
// ZMK_COMBO(mouse, &smart_mouse, LT3 LT1, DEF NAV NUM , COMBO_TERM_FAST, COMBO_IDLE_FAST)

ZMK_COMBO(mouse_left, &mkp LCLK, LT1 LT2, DEF NAV , COMBO_TERM_FAST, COMBO_IDLE_FAST)
ZMK_COMBO(mouse_right, &mkp RCLK, LT2 LT3, DEF NAV , COMBO_TERM_FAST, COMBO_IDLE_FAST)
ZMK_COMBO(mouse_middle, &mkp MCLK, LT1 LT3, DEF NAV , COMBO_TERM_FAST, COMBO_IDLE_FAST)
// ZMK_COMBO(mouse_left, &mkp LCLK, LT1 LT2, DEF NAV , COMBO_TERM_FAST, COMBO_IDLE_FAST)
// ZMK_COMBO(mouse_right, &mkp RCLK, LT2 LT3, DEF NAV , COMBO_TERM_FAST, COMBO_IDLE_FAST)
// ZMK_COMBO(mouse_middle, &mkp MCLK, LT1 LT3, DEF NAV , COMBO_TERM_FAST, COMBO_IDLE_FAST)

// ZMK_COMBO(tab, HRC_TAB, LM3 LM2, DEF NAV NUM, COMBO_TERM_FAST, COMBO_IDLE_FAST)
// ZMK_COMBO(repeat,HRC_REPEAT, LM2 LM1, DEF NAV NUM, COMBO_TERM_FAST, COMBO_IDLE_FAST)
ZMK_COMBO(cancel,HRC_CANCEL, LM2 LM1, DEF NAV NUM MOUSE, COMBO_TERM_FAST, COMBO_IDLE_FAST)
ZMK_COMBO(cancel,HRC_CANCEL, LM2 LM1, DEF NAV NUM, COMBO_TERM_FAST, COMBO_IDLE_FAST)
ZMK_COMBO(todef, HRC_DEF, LM2 LM1, MOUSE MOUSEVS MOUSEHS, COMBO_TERM_FAST, COMBO_IDLE_FAST)

ZMK_COMBO(cut, &kp LC(X), LB3 LB1, DEF NAV NUM MOUSE, COMBO_TERM_FAST, COMBO_IDLE_FAST)
ZMK_COMBO(copy, &kp LC(INS), LB3 LB2, DEF NAV NUM MOUSE, COMBO_TERM_FAST, COMBO_IDLE_FAST)
Expand Down
66 changes: 50 additions & 16 deletions config/lazycorne.keymap
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
#define SYS 4
#define UC 5
#define MOUSE 6
#define MOUSEVS 7
#define MOUSEHS 8

#include "mouse.dtsi"
#include "combos.dtsi"
Expand All @@ -48,13 +50,13 @@
scale-multiplier = <2>;
scale-divisor = <1>;
// 아직 기능이 완벽하지 않음 터치를 하는동안 인식하는것이 아니라 움직임이 나타나야 인지함
// bindings = <&ib_tog_layer MOUSE>;
bindings = <&ib_tog_layer MOUSE>;
y-invert;
};
cirque_scl {
compatible = "zmk,input-behavior-listener";
device = <&vtrackpad>;
layers = <NAV>;
layers = <MOUSEVS>;
evt-type = <INPUT_EV_REL>;

/* slienting x-axis with alt event code */
Expand All @@ -68,7 +70,7 @@
cirque_hscl {
compatible = "zmk,input-behavior-listener";
device = <&vtrackpad>;
layers = <FN>;
layers = <MOUSEHS>;
evt-type = <INPUT_EV_REL>;

/* slienting x-axis with alt event code */
Expand All @@ -81,11 +83,11 @@
bindings = <&ib_hwheel_scaler 1 16>;
};
// 아직 기능이 완벽하지 않음 터치를 하는동안 인식하는것이 아니라 움직임이 나타나야 인지함
// ib_tog_layer: ib_tog_layer {
// compatible = "zmk,input-behavior-tog-layer";
// #binding-cells = <1>;
// time-to-live-ms = <500>;
// };
ib_tog_layer: ib_tog_layer {
compatible = "zmk,input-behavior-tog-layer";
#binding-cells = <1>;
time-to-live-ms = <800>;
};
ib_wheel_scaler: ib_wheel_scaler {
compatible = "zmk,input-behavior-scaler";
#binding-cells = <2>;
Expand Down Expand Up @@ -136,6 +138,7 @@
)
MAKE_HRM(hml, &kp, &kp, KEYS_R THUMBS) // left-hand HRMs
MAKE_HRM(hmr, &kp, &kp, KEYS_L THUMBS) // right-hand HRMs
MAKE_HRM(hml_def, &kp, &to, KEYS_R THUMBS)

MAKE_HRM(hml_repeat, &kp, &key_repeat, KEYS_R THUMBS) // used for HRM-combo
MAKE_HRM(hmr_lpar_lt, &kp, &lpar_lt, KEYS_L THUMBS) // " " " "
Expand Down Expand Up @@ -200,11 +203,11 @@ ZMK_TAP_DANCE(num_dance,
};

// smart-mouse, requires PR #1366
ZMK_TRI_STATE(smart_mouse,
bindings = <&tog MOUSE>, <&none>, <&tog MOUSE>;
ignored-key-positions = <LT1 LT2 LT3 LM1 LM2 LM3 LM4 LH2 LH1 LH0>;
ignored-layers = <MOUSE>;
)
// ZMK_TRI_STATE(smart_mouse,
// bindings = <&tog MOUSE>, <&none>, <&tog MOUSE>;
// ignored-key-positions = <LT1 LT3 LM1 LM2 LM3 LM4 LH0 LH1 RH0 RH1 RH2>;
// ignored-layers = <MOUSE MOUSEVS MOUSEHS>;
// )

/* Custom behaviors */

Expand Down Expand Up @@ -326,7 +329,7 @@ ZMK_CONDITIONAL_LAYER(FN NUM, SYS) // FN + NUM --> SYS

ZMK_LAYER(base,
// ╭──────────────┬──────────────┬──────────────┬──────────────┬──────────────┬──────────────╮ ╭──────────────┬──────────────┬──────────────┬──────────────┬──────────────┬──────────────╮
&kp TAB &kp Q &kp W &kp E &kp R &kp T &kp Y &kp U &kp I &kp O &kp P &bs_del
&kp TAB &kp Q &kp W &lt MOUSEHS E &lt MOUSEVS R &kp T &kp Y &kp U &kp I &kp O &kp P &bs_del
// ├──────────────┼──────────────┼──────────────┼──────────────┼──────────────┼──────────────┤ ├──────────────┼──────────────┼──────────────┼──────────────┼──────────────┼──────────────┤
ESCM &hml LGUI A &hml LALT S &hml LSHFT D &hml LCTRL F &kp G &kp H &hmr LCTRL J &hmr LSHFT K &hmr LALT L &hmr LGUI SQT &kp LANG1
// ├──────────────┼──────────────┼──────────────┼──────────────┼──────────────┼──────────────┤ ├──────────────┼──────────────┼──────────────┼──────────────┼──────────────┼──────────────┤
Expand Down Expand Up @@ -411,13 +414,44 @@ ZMK_LAYER(uc,

ZMK_LAYER(mouse,
// ╭──────────────┬──────────────┬──────────────┬──────────────┬──────────────┬──────────────╮ ╭──────────────┬──────────────┬──────────────┬──────────────┬──────────────┬──────────────╮
___ ___ &mkp MCLK &mkp RCLK &mkp LCLK ___ ___ ___ ___ ___ ___ ___
___ ___ ___ &mo MOUSEHS &mo MOUSEVS ___ ___ ___ ___ ___ ___ ___
// ├──────────────┼──────────────┼──────────────┼──────────────┼──────────────┼──────────────┤ ├──────────────┼──────────────┼──────────────┼──────────────┼──────────────┼──────────────┤
___ &kp LGUI &kp LALT &kp LSHFT &kp LCTRL ___ ___ ___ ___ ___ ___ ___
// ├──────────────┼──────────────┼──────────────┼──────────────┼──────────────┼──────────────┤ ├──────────────┼──────────────┼──────────────┼──────────────┼──────────────┼──────────────┤
___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___
// ╰──────────────┴──────────────┴──────────────┼──────────────┼──────────────┼──────────────┤ ├──────────────┼──────────────┼──────────────┼──────────────┴──────────────┴──────────────╯
&mkp MCLK &mkp RCLK &mkp LCLK ___ ___ ___
// ╰──────────────┴──────────────┴──────────────╯ ╰──────────────┴──────────────┴──────────────╯
)

ZMK_LAYER(mouse_vs,
// ╭──────────────┬──────────────┬──────────────┬──────────────┬──────────────┬──────────────╮ ╭──────────────┬──────────────┬──────────────┬──────────────┬──────────────┬──────────────╮
___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___
// ├──────────────┼──────────────┼──────────────┼──────────────┼──────────────┼──────────────┤ ├──────────────┼──────────────┼──────────────┼──────────────┼──────────────┼──────────────┤
___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___
// ├──────────────┼──────────────┼──────────────┼──────────────┼──────────────┼──────────────┤ ├──────────────┼──────────────┼──────────────┼──────────────┼──────────────┼──────────────┤
___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___
// ╰──────────────┴──────────────┴──────────────┼──────────────┼──────────────┼──────────────┤ ├──────────────┼──────────────┼──────────────┼──────────────┴──────────────┴──────────────╯
___ ___ ___ ___ ___ ___
// ╰──────────────┴──────────────┴──────────────╯ ╰──────────────┴──────────────┴──────────────╯
)

ZMK_LAYER(mouse_hs,
// ╭──────────────┬──────────────┬──────────────┬──────────────┬──────────────┬──────────────╮ ╭──────────────┬──────────────┬──────────────┬──────────────┬──────────────┬──────────────╮
___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___
// ├──────────────┼──────────────┼──────────────┼──────────────┼──────────────┼──────────────┤ ├──────────────┼──────────────┼──────────────┼──────────────┼──────────────┼──────────────┤
___ SK_A SK_S SK_D SK_F ___ ___ ___ ___ ___ ___ ___
___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___
// ├──────────────┼──────────────┼──────────────┼──────────────┼──────────────┼──────────────┤ ├──────────────┼──────────────┼──────────────┼──────────────┼──────────────┼──────────────┤
___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___
// ╰──────────────┴──────────────┴──────────────┼──────────────┼──────────────┼──────────────┤ ├──────────────┼──────────────┼──────────────┼──────────────┴──────────────┴──────────────╯
___ ___ ___ ___ ___ ___
// ╰──────────────┴──────────────┴──────────────╯ ╰──────────────┴──────────────┴──────────────╯
)

// &usbd {
// status = "okay";
// cdc_acm_uart: cdc_acm_uart {
// compatible = "zephyr,cdc-acm-uart";
// label = "CDC_ACM_0";
// };
// };

0 comments on commit eaa3998

Please sign in to comment.