/* * Copyright (c) 2020 duckyb * * SPDX-License-Identifier: MIT */ #include #include #include #include #include "zmk-helpers/helper.h" #include "zmk-helpers/key-labels/42.h" #include #define QUICK_TAP_MS 175 // Layer definitions #define BASE 0 #define NUM 1 #define SYM 2 #define NAV 3 #define FNC 4 #define SETTINGS 5 /* Homerow mods */ #define HM_TAPPING_TERM 300 #define HM_TAPPING_TERM_FAST 200 #define HM_PRIOR_IDLE 150 #define KEYS_L LT0 LT1 LT2 LT3 LT4 LM0 LM1 LM2 LM3 LM4 LB0 LB1 LB2 LB3 LB4 // left hand #define KEYS_R RT0 RT1 RT2 RT3 RT4 RM0 RM1 RM2 RM3 RM4 RB0 RB1 RB2 RB3 RB4 // right hand #define KEYS_T LH1 LH0 RH0 RH1 // thumbs on 34 keys // ----------------- &sk { // don't release mods on other mods presses ignore-modifiers; }; &mt { // mode-tap config flavor = "tap-preferred"; tapping_term_ms = <200>; quick_tap_ms = <75>; }; < { // layer-tap config flavor = "balanced"; tapping-term-ms = <200>; quick-tap-ms = ; }; / { behaviors { // Positional Homerow mods // Homerow mods that prevent accidental activations when rolling keys, // such as when typing `st` or `ne` on colemak-dh layouts or `as` on // qwerty. // // Works by only allowing a mod to activate within tapping-term if // it's on the opposite side of the keyboard or on the same side thumb // keys. // Further optimization using urob's timerless homerow mods method: // https://github.com/urob/zmk-config#timeless-homerow-mods hml: homerow_mods_left { compatible = "zmk,behavior-hold-tap"; #binding-cells = <2>; bindings = <&kp>, <&kp>; flavor = "balanced"; tapping-term-ms = ; quick-tap-ms = <175>; // repeat on tap-into-hold require-prior-idle-ms = ; hold-trigger-key-positions = ; hold-trigger-on-release; }; hmr: homerow_mods_right { compatible = "zmk,behavior-hold-tap"; #binding-cells = <2>; bindings = <&kp>, <&kp>; flavor = "balanced"; tapping-term-ms = ; quick-tap-ms = <175>; require-prior-idle-ms = ; hold-trigger-key-positions = ; hold-trigger-on-release; }; // Enables holding the first mod-tap key // by performing a tap-release-hold sequence. // To use it: "&qt KEYCODE1 KEYCODE2" qt: quick_tap { compatible = "zmk,behavior-hold-tap"; label = "QUICK_TAP"; #binding-cells = <2>; flavor = "hold-preferred"; tapping-term-ms = <200>; quick-tap-ms = <200>; bindings = <&kp>, <&kp>; }; }; macros { // sometimes my device thinks a modifier is being held down // pressing all modifiers fixes it. unstick: unstick { label = "ZM_unstick"; compatible = "zmk,behavior-macro"; #binding-cells = <0>; bindings = <&kp LSHIFT &kp RSHIFT &kp LCTRL &kp RCTRL &kp LALT &kp RALT &kp LGUI &kp RGUI>; }; }; combos { compatible = "zmk,combos"; // both right thumb keys combo_esc { timeout-ms = <200>; key-positions = <32 33>; bindings = <&kp ESC>; }; // internal-left & external-right thumb keys // both left thumb keys combo_settings { timeout-ms = <200>; key-positions = <30 31>; bindings = <&mo SETTINGS>; }; }; keymap { compatible = "zmk,keymap"; // Base alpha layer default_layer { label = "Base"; bindings = < &kp SQT &kp COMMA &kp DOT &kp P &kp Y &kp F &kp G &kp C &kp R &kp L &hml LCTRL A &hml LALT O &hml LSHIFT E &hml LGUI U &kp I &kp D &hmr RGUI H &hmr RSHIFT T &hmr RALT N &hmr RCTRL S &hml LCTRL SCLN &kp Q &kp J &kp K &kp X &kp B &kp M &kp W &kp V &kp Z < NUM SPC < SYM BSPC < NAV TAB < FNC RET >; }; // Numbers and high frequency symbols num_layer { label = "Num."; bindings = < &none &none &none &none &none &kp MINUS &kp N7 &kp N8 &kp N9 &none &trans &trans &trans &trans &none &kp KP_PLUS &kp N4 &kp N5 &kp N6 &kp EQUAL &none &none &none &none &none &kp N0 &kp N1 &kp N2 &kp N3 &none &mo FNC &none &trans &trans >; }; // Symbols sym_layer { label = "Sym."; bindings = < &none &none &none &none &none &kp MINUS &kp AMPS &kp STAR &kp N9 &kp FSLH &trans &trans &trans &trans &none &kp GRAVE &kp DLLR &kp PRCNT &kp CARET &kp QUESTION &none &none &none &none &none &kp TILDE &kp EXCL &kp AT &kp HASH &kp BSLH &trans &trans &trans &trans >; }; // Main modifiers and arrow keys nav_layer { label = "Nav."; bindings = < &none &none &none &none &none &none &none &none &none &none &trans &trans &trans &trans &none &none &none &none &none &none &none &none &none &none &none &none &none &none &none &none &trans &trans &trans &trans >; }; // Function keys with modifiers fnc_layer { label = "FRow"; bindings = < &kp EXCL &kp AT &kp UP &kp DLLR &kp PRCNT &none &none &none &none &none &kp LPAR &kp LEFT &kp DOWN &kp RIGHT &kp RPAR &none &none &none &none &none &kp LBKT &kp RBKT &kp HASH &kp LBRC &kp RBRC &none &none &none &none &none &none &none &trans &trans >; }; // Used to change the keyboard's settings. settings_layer { label = "Sett."; bindings = < &bootloader &none &none &bt BT_CLR &bt BT_SEL 0 &bt BT_SEL 3 &none &unstick &none &bootloader &none &none &none &none &bt BT_SEL 1 &bt BT_SEL 4 &none &none &none &none &none &none &none &none &bt BT_SEL 2 &bt BT_SEL 5 &none &none &none &none &none &none &none &none >; }; }; };