From 6bf324125af9010ccd81a50738cf8dcb20f40365 Mon Sep 17 00:00:00 2001 From: jakobst1n Date: Wed, 13 Mar 2024 18:19:28 +0100 Subject: Tweak --- config/includes/combos.dtsi.old | 183 ---------------------------------------- config/includes/common.h | 67 +++++++++++++++ config/includes/homerow.h | 22 +++++ config/includes/keypos_42keys.h | 62 ++++++++++++++ config/includes/mouse_tp.dtsi | 4 +- config/includes/unicode.h | 85 +++++++++++++++++++ 6 files changed, 238 insertions(+), 185 deletions(-) delete mode 100644 config/includes/combos.dtsi.old create mode 100644 config/includes/common.h create mode 100644 config/includes/homerow.h create mode 100644 config/includes/keypos_42keys.h create mode 100644 config/includes/unicode.h (limited to 'config/includes') diff --git a/config/includes/combos.dtsi.old b/config/includes/combos.dtsi.old deleted file mode 100644 index f24cffb..0000000 --- a/config/includes/combos.dtsi.old +++ /dev/null @@ -1,183 +0,0 @@ -#define COMBO_TERM_FAST 35 -#define COMBO_TERM_SLOW 40 -#define COMBO_PRIOR_IDLE 100 - -/ { - combos { - compatible = "zmk,combos"; - - combo_bracket_v_round_l { - timeout-ms = ; - require-prior-idle-ms = ; - key-positions = ; - layers = ; - bindings = <&kp LPAR>; - }; - - combo_bracket_v_round_r { - timeout-ms = ; - require-prior-idle-ms = ; - key-positions = ; - layers = ; - bindings = <&kp RPAR>; - }; - - combo_bracket_v_square_l { - timeout-ms = ; - require-prior-idle-ms = ; - key-positions = ; - layers = ; - bindings = <&kp LBKT>; - }; - - combo_bracket_v_square_r { - timeout-ms = ; - require-prior-idle-ms = ; - key-positions = ; - layers = ; - bindings = <&kp RBKT>; - }; - - combo_bracket_v_curly_l { - timeout-ms = ; - require-prior-idle-ms = ; - key-positions = ; - layers = ; - bindings = <&kp LBRC>; - }; - - combo_bracket_v_curly_r { - timeout-ms = ; - require-prior-idle-ms = ; - key-positions = ; - layers = ; - bindings = <&kp RBRC>; - }; - - combo_bracket_v_angled_l { - timeout-ms = ; - require-prior-idle-ms = ; - key-positions = ; - layers = ; - bindings = <&kp LT>; - }; - - combo_bracket_v_angled_r { - timeout-ms = ; - require-prior-idle-ms = ; - key-positions = ; - layers = ; - bindings = <&kp GT>; - }; - - combo_capsword { - timeout-ms = ; - require-prior-idle-ms = ; - key-positions = ; - layers = ; - -#ifdef HAS_CAPSLOCK - bindings = <&caps_word_capslock >; -#else - bindings = <&caps_word>; -#endif - }; - - combo_return { - timeout-ms = ; - require-prior-idle-ms = ; - key-positions = ; - layers = ; - bindings = <&kp RET>; - }; - - combo_bspc { - timeout-ms = ; - require-prior-idle-ms = ; - key-positions = ; - layers = ; - bindings = <&kp BSPC>; - }; - - // combo_grave { - // timeout-ms = ; - // require-prior-idle-ms = ; - // key-positions = ; - // layers = <>; - // bindings = <&kp GRAVE>; - // }; - - // combo_md_code_block { - // timeout-ms = ; - // require-prior-idle-ms = ; - // key-positions = ; - // layers = <>; - // bindings = <&m_type_md_code_block>; - // }; - - combo_tog_nav_word { - timeout-ms = ; - require-prior-idle-ms = ; - key-positions = ; - layers = ; - - #ifdef HAS_UROB - bindings = <&nav_word>; - #else - bindings = <&tog NAV_WORD>; - #endif - - }; - - combo_tog_num_word { - timeout-ms = ; - require-prior-idle-ms = ; - key-positions = ; - layers = ; - - #ifdef HAS_UROB - bindings = <&num_word>; - #else - bindings = <&tog NUM_WORD>; - #endif - - }; - -#ifdef HAS_MOUSE_TP - combo_tog_mouse_settings_l { - timeout-ms = ; - // require-prior-idle-ms = ; - key-positions = ; - layers = ; - bindings = <&tog MOUSE_SET>; - }; - - combo_tog_mouse_settings_r { - timeout-ms = ; - // require-prior-idle-ms = ; - key-positions = ; - layers = ; - bindings = <&tog MOUSE_SET>; - }; -#endif - -#ifdef HAS_MOUSE_KEYS - combo_tog_mouse_keys_l { - timeout-ms = ; - // require-prior-idle-ms = ; - key-positions = ; - layers = ; - bindings = <&tog MOUSE_KEYS>; - }; - - combo_tog_mouse_keys_r { - timeout-ms = ; - // require-prior-idle-ms = ; - key-positions = ; - layers = ; - bindings = <&tog MOUSE_KEYS>; - }; -#endif - - }; -}; diff --git a/config/includes/common.h b/config/includes/common.h new file mode 100644 index 0000000..79528c8 --- /dev/null +++ b/config/includes/common.h @@ -0,0 +1,67 @@ +#define ___ &trans +#define XXX &none + +#ifndef QUICK_TAP_MS + #define QUICK_TAP_MS 162 +#endif + +#define ZMK_HELPER_STRINGIFY(x) #x + +#define MO_TOG(layer) &mo_tog layer layer // Macro to apply momentary-layer-on-hold/toggle-layer-on-tap to a specific layer + +&sk { // sticky-key config + release-after-ms = <900>; // release after 0.6s + quick-release; // no double capitalization when rolling keys +}; + +&sl { // sticky-layer config + ignore-modifiers; // allow chording sticky mods & layers +}; + +< { // layer-tap config + flavor = "balanced"; + tapping-term-ms = <200>; + quick-tap-ms = ; +}; + + +// Some general behaviours that are slightly tweaked from the core +/ { + behaviours { + kp_mo_tap: behavior_kp_mo_tap { + compatible = "zmk,behavior-hold-tap"; + label = "kp_mo_tap"; + #binding-cells = <2>; + flavor = "tap-preferred"; + tapping-term-ms = <200>; + quick-tap-ms = <200>; + //require-prior-idle-ms = <140>; + bindings = <&mo>, <&kp>; + }; + kp_mo_hold: behavior_kp_mo_hold { + compatible = "zmk,behavior-hold-tap"; + label = "kp_mo_hold"; + #binding-cells = <2>; + flavor = "hold-preferred"; + tapping-term-ms = <200>; + quick-tap-ms = <200>; + //require-prior-idle-ms = <140>; + bindings = <&mo>, <&kp>; + }; + kp_mt: behavior_kp_mt { + compatible = "zmk,behavior-hold-tap"; + label = "kp_mt"; + #binding-cells = <2>; + flavor = "tap-preferred"; + tapping-term-ms = ; + quick-tap-ms = ; + //require-prior-idle-ms = <100>; + bindings = <&kp>, <&kp>; + }; + }; +}; + + +#include "homerow.h" +#include "unicode.h" + diff --git a/config/includes/homerow.h b/config/includes/homerow.h new file mode 100644 index 0000000..c8fe06f --- /dev/null +++ b/config/includes/homerow.h @@ -0,0 +1,22 @@ +#pragma once + +#define MAKE_HRM(NAME, HOLD, TAP) \ + / { \ + behaviours { \ + NAME: NAME { \ + label = ZMK_HELPER_STRINGIFY(ZB_ ## NAME); \ + compatible = "zmk,behavior-hold-tap"; \ + #binding-cells = <2>; \ + flavor = "balanced"; \ + tapping-term-ms = <280>; \ + quick-tap-ms = ; \ + require-prior-idle-ms = <150>; \ + bindings = , ; \ + hold-trigger-on-release; \ + }; \ + }; \ + }; + +MAKE_HRM(hml, &kp, &kp) +MAKE_HRM(hmr, &kp, &kp) + diff --git a/config/includes/keypos_42keys.h b/config/includes/keypos_42keys.h new file mode 100644 index 0000000..21f7052 --- /dev/null +++ b/config/includes/keypos_42keys.h @@ -0,0 +1,62 @@ +// https://raw.githubusercontent.com/urob/zmk-nodefree-config/8506dbaaee9b46d200aa553a94b6dbca8560a5e1/keypos_def/keypos_42keys.h +/* 42 KEY MATRIX / LAYOUT MAPPING + + ╭────────────────────────┬────────────────────────╮ ╭─────────────────────────┬─────────────────────────╮ + │ 0 1 2 3 4 5 │ 6 7 8 9 10 11 │ │ LT5 LT4 LT3 LT2 LT1 LT0 │ RT0 RT1 RT2 RT3 RT4 RT5 │ + │ 12 13 14 15 16 17 │ 18 19 20 21 22 23 │ │ LM5 LM4 LM3 LM2 LM1 LM0 │ RM0 RM1 RM2 RM3 RM4 RM5 │ + │ 24 25 26 27 28 29 │ 30 31 32 33 34 35 │ │ LB5 LB4 LB3 LB2 LB1 LB0 │ RB0 RB1 RB2 RB3 RB4 RB5 │ + ╰───────────╮ 36 37 38 │ 39 40 41 ╭───────────╯ ╰───────────╮ LH2 LH1 LH0 │ RH0 RH1 RH2 ╭───────────╯ + ╰────────────┴────────────╯ ╰─────────────┴─────────────╯ */ + +#pragma once + +#define LT0 5 // left-top row +#define LT1 4 +#define LT2 3 +#define LT3 2 +#define LT4 1 +#define LT5 0 + +#define RT0 6 // right-top row +#define RT1 7 +#define RT2 8 +#define RT3 9 +#define RT4 10 +#define RT5 11 + +#define LM0 17 // left-middle row +#define LM1 16 +#define LM2 15 +#define LM3 14 +#define LM4 13 +#define LM5 12 + +#define RM0 18 // right-middle row +#define RM1 19 +#define RM2 20 +#define RM3 21 +#define RM4 22 +#define RM5 23 + +#define LB0 29 // left-bottom row +#define LB1 28 +#define LB2 27 +#define LB3 26 +#define LB4 25 +#define LB5 24 + +#define RB0 30 // right-bottom row +#define RB1 31 +#define RB2 32 +#define RB3 33 +#define RB4 34 +#define RB5 35 + +#define LH0 38 // left thumb keys +#define LH1 37 +#define LH2 36 + +#define RH0 39 // right thumb keys +#define RH1 40 +#define RH2 41 + diff --git a/config/includes/mouse_tp.dtsi b/config/includes/mouse_tp.dtsi index 6345cf4..358a5f6 100644 --- a/config/includes/mouse_tp.dtsi +++ b/config/includes/mouse_tp.dtsi @@ -94,7 +94,7 @@ // How sensitive the TP is (Default: 128) - tp-sensitivity = <135>; + tp-sensitivity = <205>; // The maximum mouse movement speed the TP will accelarate to (Default: 97) @@ -135,7 +135,7 @@ // How long to wait, after the last mouse movement, before deactivating // the layer (Default: 250) - layer-toggle-timeout-ms = <1000>; + layer-toggle-timeout-ms = <425>; }; diff --git a/config/includes/unicode.h b/config/includes/unicode.h new file mode 100644 index 0000000..df2b298 --- /dev/null +++ b/config/includes/unicode.h @@ -0,0 +1,85 @@ +#pragma once + +#define COMBO(name, POS, LAYERS, BINDINGS) \ + / { \ + combos { \ + compatible = "zmk,combos"; \ + name { \ + timeout-ms = <50>; \ + key-positions = ; \ + layers = ; \ + bindings = ; \ + }; \ + }; \ + }; + +/* ZMK_UNICODE */ +#define UC_LEAD_MACWIN ¯o_press &kp LALT // macOS/Windows-Alt-Codes +#define UC_LEAD_LINUX ¯o_tap &kp LS(LC(U)) // Linux +#define UC_LEAD_WINDOWS ¯o_tap &kp RALT &kp U // Windows + WinCompose (default) + +#define UC_TRAIL_MACWIN ¯o_release &kp LALT // macOS/Windows-Alt-Codes +#define UC_TRAIL_LINUX ¯o_tap &kp SPACE // Linux +#define UC_TRAIL_WINDOWS ¯o_tap &kp RET // Windows + WinCompose (default) + +#define UC_MACRO_LINUX(name, unicode_bindings) \ + / { \ + macros { \ + name: name { \ + compatible = "zmk,behavior-macro"; \ + label = ZMK_HELPER_STRINGIFY(UC_MACRO_ ## name); \ + wait-ms = <0>; \ + tap-ms = <0>; \ + #binding-cells = <0>; \ + bindings = , <¯o_tap unicode_bindings>, ; \ + }; \ + }; \ + }; +#define UC_MACRO_MACWIN(name, unicode_bindings) \ + / { \ + macros { \ + name: name { \ + compatible = "zmk,behavior-macro"; \ + label = ZMK_HELPER_STRINGIFY(UC_MACRO_ ## name); \ + wait-ms = <0>; \ + tap-ms = <0>; \ + #binding-cells = <0>; \ + bindings = , <¯o_tap unicode_bindings>, ; \ + }; \ + }; \ + }; + +#define UC_MODMORPH(name, uc_binding, shifted_uc_binding) \ + / { \ + behaviors { \ + name: name { \ + compatible = "zmk,behavior-mod-morph"; \ + label = ZMK_HELPER_STRINGIFY(UC_MORPH_ ## name); \ + #binding-cells = <0>; \ + bindings = , ; \ + mods = <(MOD_LSFT|MOD_RSFT)>; \ + }; \ + }; \ + }; + +#define ZMK_UNICODE_SINGLE(name, L0, L1, L2, L3) \ + UC_MACRO(name ## _lower, &kp L0 &kp L1 &kp L2 &kp L3) \ + UC_MODMORPH(name, &name ## _lower, &none) + +#define ZMK_UNICODE_PAIR_LINUX(name, L0, L1, L2, L3, U0, U1, U2, U3) \ + UC_MACRO_LINUX(name ## _lower, &kp L0 &kp L1 &kp L2 &kp L3) \ + UC_MACRO_LINUX(name ## _upper, &kp U0 &kp U1 &kp U2 &kp U3) \ + UC_MODMORPH(name, &name ## _lower, &name ## _upper) + +#define ZMK_UNICODE_PAIR_MACWIN(name, L0, L1, L2, L3, U0, U1, U2, U3) \ + UC_MACRO_MACWIN(name ## _lower, &kp L0 &kp L1 &kp L2 &kp L3) \ + UC_MACRO_MACWIN(name ## _upper, &kp U0 &kp U1 &kp U2 &kp U3) \ + UC_MODMORPH(name, &name ## _lower, &name ## _upper) + +ZMK_UNICODE_PAIR_MACWIN(mwn_no_ae, N0, N0, E, N6, N0, N0, C, N6) +ZMK_UNICODE_PAIR_MACWIN(mwn_no_ao, N0, N0, E, N5, N0, N0, C, N5) +ZMK_UNICODE_PAIR_MACWIN(mwn_no_oe, N0, N0, F, N8, N0, N0, D, N8) +ZMK_UNICODE_PAIR_LINUX(lnx_no_ae, N0, N0, E, N6, N0, N0, C, N6) +ZMK_UNICODE_PAIR_LINUX(lnx_no_ao, N0, N0, E, N5, N0, N0, C, N5) +ZMK_UNICODE_PAIR_LINUX(lnx_no_oe, N0, N0, F, N8, N0, N0, D, N8) + -- cgit v1.2.3