diff --git a/config/urchin.keymap b/config/urchin.keymap index 98f55cf..f32ea2b 100644 --- a/config/urchin.keymap +++ b/config/urchin.keymap @@ -9,12 +9,29 @@ #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 SYM 1 #define EXT 2 #define FNC 3 -#define SETTINGS 6 +#define SETTINGS 4 + +/* 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 { @@ -23,15 +40,59 @@ }; -&mt { +&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" @@ -83,10 +144,10 @@ default_layer { label = "Base"; bindings = < - &kp DOT &kp COMMA &kp DOT &kp P &kp Y &kp F &kp G &kp C &kp R &kp L - &kp A &kp O &kp E &kp U &kp I &kp D &kp H &kp T &kp N &kp S - &kp SCLN &kp Q &kp J &kp K &kp X &kp B &kp M &kp W &kp V &kp Z - &mt LALT SPC &mt LGUI TAB &mt LSHIFT RET &mt LCTRL BSPC + &kp DOT &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 + &kp SCLN &kp Q &kp J &kp K &kp X &kp B &kp M &kp W &kp V &kp Z + &mt LALT SPC &mt LGUI TAB &mt LSHIFT RET &mt LCTRL BSPC >; }; @@ -94,10 +155,10 @@ sym_layer { label = "Sym."; bindings = < - &kp N1 &kp N2 &kp N3 &kp N4 &kp N5 &kp N6 &kp N7 &kp N8 &kp N9 &kp N0 - &none &none &none &none &none &none &none &none &none &none - &none &none &none &none &none &none &none &none &none &none - &mo FNC &none &trans &trans + &none &none &none &none &none &none &kp N7 &kp N8 &kp N9 &none + &none &none &none &none &none &none &kp N4 &kp N5 &kp N6 &none + &none &none &none &none &none &kp N0 &kp N1 &kp N2 &kp N3 &none + &mo FNC &none &trans &trans >; }; diff --git a/config/west.yml b/config/west.yml index 927d0e5..2ea3236 100644 --- a/config/west.yml +++ b/config/west.yml @@ -6,6 +6,8 @@ manifest: # kyek / duckyb - name: duckyb url-base: https://github.com/duckyb + - name: urob + url-base: https://github.com/urob projects: - name: zmk remote: zmkfirmware @@ -14,5 +16,11 @@ manifest: - name: urchin-zmk-module remote: duckyb revision: main + - name: zmk-helpers + remote: urob + revision: main + - name: zmk-auto-layer + remote: urob + revision: main self: path: config diff --git a/flake.nix b/flake.nix index 8bbafe9..3e04642 100644 --- a/flake.nix +++ b/flake.nix @@ -33,7 +33,7 @@ shield = "urchin_%PART%"; zephyrDepsHash = - "sha256-9QwsEJAoMrTp4gHgCsSsrAiDC1JN3brLSINIxKJKq08="; + "sha256-DXOQ+Hu8p1qeLiB1loRmKG9YOVbkJWMOrDI/aVA472M="; meta = { description = "ZMK firmware";