From 4f8d1f93474bd04bf27f68961c22ca7e1e9ea0e0 Mon Sep 17 00:00:00 2001 From: urob <978080+urob@users.noreply.github.com> Date: Sun, 5 Mar 2023 18:07:29 -0500 Subject: [PATCH] Smart-mouse layer --- config/base.keymap | 30 ++++++++---------------------- config/corneish_zen.keymap | 2 +- config/mouse.dtsi | 16 ++++++++-------- config/planck_rev6.keymap | 2 +- 4 files changed, 18 insertions(+), 32 deletions(-) diff --git a/config/base.keymap b/config/base.keymap index bfd3377..e547941 100644 --- a/config/base.keymap +++ b/config/base.keymap @@ -17,14 +17,12 @@ #define NUM 3 #define SYS 4 #define UC 5 -#define MWH 6 -#define MOUSE 7 +#define MOUSE 6 #include "combos.dtsi" // must be sourced after layer-shortcuts #include "mouse.dtsi" #include "extra_keys.h" -ZMK_CONDITIONAL_LAYER(FN NAV, MOUSE) // FN + NAV --> MOUSE ZMK_CONDITIONAL_LAYER(FN NUM, SYS) // FN + NUM --> SYS /* Navigation keys and misc shortcuts */ @@ -119,11 +117,11 @@ ZMK_BEHAVIOR(num_layer_word, hold_tap, ) #define NUM_WORD &num_layer_word NUM 0 -// scroll-mode, requires PR #1366 -ZMK_BEHAVIOR(scroll_mode, tri_state, - bindings = <&tog MWH>, <&none>, <&tog MWH>; - ignored-key-positions = ; - ignored-layers = ; +// mouse layer that deactivates automatically on all other keys, requires PR #1366 +ZMK_BEHAVIOR(smart_mouse, tri_state, + bindings = <&tog MOUSE>, <&none>, <&tog MOUSE>; + ignored-key-positions = ; // mouse keys + ignored-layers = ; ) // tap: sticky shift | double tap: capsword | triple tap: cancel capsword @@ -300,27 +298,15 @@ ZMK_LAYER(uc, //╰──────╯ ╰─────────────┴─────────────╯ ╰──────╯ ╰───────────────────────────╯ ╰──────╯ ) -ZMK_LAYER(scroll, -//╭──────╮ ╭─────────────┬─────────────┬─────────────┬─────────────┬─────────────╮ ╭──────╮ ╭─────────────┬─────────────┬─────────────┬─────────────┬─────────────╮ ╭──────╮ - X_LT ___ ___ ___ ___ ___ X_MT ___ ___ U_WH_U ___ ___ X_RT -//├──────┤ ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ ├──────┤ ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ ├──────┤ - X_LM ___ ___ ___ ___ ___ X_MM ___ ___ U_WH_D ___ ___ X_RM -//├──────┤ ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ ├──────┤ ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ ├──────┤ - X_LB ___ ___ ___ ___ ___ X_MB ___ ___ ___ ___ ___ X_RB -//├──────┤ ╰─────────────┼─────────────┴─────────────┼─────────────┼─────────────┤ ├──────┤ ├─────────────┼─────────────┼─────────────┴───────────────────────────╯ ├──────┤ - X_LH ___ ___ X_MH ___ ___ X_RH -//╰──────╯ ╰─────────────┴─────────────╯ ╰──────╯ ╰─────────────┴─────────────╯ ╰──────╯ -) - ZMK_LAYER(mouse, //╭──────╮ ╭─────────────┬─────────────┬─────────────┬─────────────┬─────────────╮ ╭──────╮ ╭─────────────┬─────────────┬─────────────┬─────────────┬─────────────╮ ╭──────╮ - X_LT ___ ___ ___ ___ ___ X_MT ___ ___ U_MS_U ___ ___ X_RT + X_LT ___ ___ ___ ___ ___ X_MT ___ U_WH_D U_MS_U U_WH_U ___ X_RT //├──────┤ ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ ├──────┤ ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ ├──────┤ X_LM ___ ___ ___ ___ ___ X_MM ___ U_MS_L U_MS_D U_MS_R ___ X_RM //├──────┤ ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ ├──────┤ ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ ├──────┤ X_LB ___ ___ ___ ___ ___ X_MB ___ ___ ___ ___ ___ X_RB //├──────┤ ╰─────────────┼─────────────┴─────────────┼─────────────┼─────────────┤ ├──────┤ ├─────────────┼─────────────┼─────────────┴───────────────────────────╯ ├──────┤ - X_LH ___ ___ X_MH U_BTN1 U_BTN2 X_RH + X_LH ___ ___ X_MH U_BTN2 U_BTN1 X_RH //╰──────╯ ╰─────────────┴─────────────╯ ╰──────╯ ╰─────────────┴─────────────╯ ╰──────╯ ) diff --git a/config/corneish_zen.keymap b/config/corneish_zen.keymap index 1d4b2bc..022d91c 100644 --- a/config/corneish_zen.keymap +++ b/config/corneish_zen.keymap @@ -2,7 +2,7 @@ #include "../zmk-nodefree-config/keypos_def/keypos_36keys.h" /* map Zen's extra keys */ -#define X_LH &scroll_mode // thumb row, left +#define X_LH &smart_mouse // thumb row, left #define X_RH &kp RET // thumb row, right /* activate bluetooth */ diff --git a/config/mouse.dtsi b/config/mouse.dtsi index 8ab2147..84294af 100644 --- a/config/mouse.dtsi +++ b/config/mouse.dtsi @@ -1,19 +1,19 @@ #include &mmv { - acceleration-exponent = <1>; - time-to-max-speed-ms = <40>; - delay-ms = <0>; + acceleration-exponent = <1>; // 1 + time-to-max-speed-ms = <1500>; // 40 + delay-ms = <0>; // 0 }; &mwh { - acceleration-exponent = <0>; - time-to-max-speed-ms = <40>; - delay-ms = <10>; + acceleration-exponent = <1>; // 0 + time-to-max-speed-ms = <5000>; // 40 + delay-ms = <0>; // 10 }; -#define U_MOUSE_MOVE_MAX 600 -#define U_MOUSE_SCROLL_MAX 10 +#define U_MOUSE_MOVE_MAX 1250 // 600 +#define U_MOUSE_SCROLL_MAX 100 // 10 #undef MOVE_UP #undef MOVE_DOWN diff --git a/config/planck_rev6.keymap b/config/planck_rev6.keymap index f3156cb..d9507c3 100644 --- a/config/planck_rev6.keymap +++ b/config/planck_rev6.keymap @@ -5,7 +5,7 @@ #define X_MT &none &none // top row, middle #define X_MM &none &none // middle row, middle #define X_MB &none &none // bottom row, middle -#define X_LH &none &kp LGUI &scroll_mode // thumb row, left +#define X_LH &none &kp LGUI &smart_mouse // thumb row, left #define X_MH &none &none // thumb row, middle #define X_RH &kp RET U_WH_D U_WH_U // thumb row, right