diff options
-rw-r--r-- | config/hanck_duo.conf | 1 | ||||
-rw-r--r-- | config/hanck_duo.keymap | 134 | ||||
-rw-r--r-- | flake.lock | 34 | ||||
-rw-r--r-- | flake.nix | 18 |
4 files changed, 185 insertions, 2 deletions
diff --git a/config/hanck_duo.conf b/config/hanck_duo.conf new file mode 100644 index 0000000..56a8169 --- /dev/null +++ b/config/hanck_duo.conf @@ -0,0 +1 @@ +CONFIG_ZMK_KEYBOARD_NAME="my_hanck_duo" diff --git a/config/hanck_duo.keymap b/config/hanck_duo.keymap new file mode 100644 index 0000000..7321784 --- /dev/null +++ b/config/hanck_duo.keymap @@ -0,0 +1,134 @@ +#include <behaviors.dtsi> +#include <dt-bindings/zmk/bt.h> +#include <dt-bindings/zmk/ext_power.h> +#include <dt-bindings/zmk/keys.h> +#include <dt-bindings/zmk/mouse.h> +#include <zmk-helpers/key-labels/4x12.h> + +/* + LT5 LT4 LT3 LT2 LT1 LT0 RT0 RT1 RT2 RT3 RT4 RT5 + LM5 LM4 LM3 LM2 LM1 LM0 RM0 RM1 RM2 RM3 RM4 RM5 + LB5 LB4 LB3 LB2 LB1 LB0 RB0 RB1 RB2 RB3 RB4 RB5 + LH5 LH4 LH3 LH2 LH1 LH0 RH0 RH1 RH2 RH3 RH4 RH5 +*/ + +// layers +#define default 0 +#define lower 1 +#define upper 2 +#define adjust 3 +#define nav 4 +#define num 5 +/ { + keymap { + compatible = "zmk,keymap"; + default_layer { + bindings = < + &kp TAB &kp Q &kp W &kp E &kp R &kp T &kp Y &kp U &kp I &kp O &kp P &kp BSLH + &kp ESC &kp A &kp S &kp D &kp F &kp G &kp H &kp J &kp K &kp L &kp SEMI < nav RET + &kp LSHFT &kp Z &kp X &kp C &kp V &kp B &kp N &kp M &kp COMMA &kp DOT &kp FSLH &kp RSHFT + &kp LCTRL &kp LGUI &kp LALT &kp LSHFT &mo lower &kp SPACE < num SPACE &mo upper &kp RSHFT &kp RALT &kp K_APP &kp RCTRL + >; + }; + lower_layer { + bindings = < + &kp TILDE &kp N1 &kp N2 &kp N3 &kp N4 &kp N5 &kp N6 &kp N7 &kp N8 &kp N9 &kp N0 &kp BSLH + &kp GRAVE &kp EXCL &kp AT &kp HASH &kp DOLLAR &kp PRCNT &kp CARET &kp AMPS &kp STAR &kp LPAR &kp RPAR &kp PIPE + &trans &kp F1 &kp F2 &kp F3 &kp F4 &kp F5 &kp PLUS &kp MINUS &kp EQUAL &kp LBKT &kp RBKT &trans + &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &kp RGUI &trans + >; + }; + upper_layer { + bindings = < + &none &none &none &none &none &none &none &none &none &none &none &none + &none &none &none &none &none &none &none &none &none &none &none &none + &trans &none &none &none &none &none &mkp LCLK &mkp MCLK &mkp RCLK &mkp MB4 &mkp MB5 &trans + &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans + >; + }; + adjust_layer { + bindings = < + &bt BT_CLR &none &none &none &none &none &bt BT_SEL 0 &bt BT_SEL 1 &bt BT_SEL 2 &bt BT_SEL 3 &bt BT_SEL 4 &none + &none &none &none &kp C_VOL_UP &kp C_VOL_DN &kp C_MUTE &kp C_BRI_MIN &kp C_BRI_DN &kp C_BRI_UP &kp C_BRI_MAX &none &none + &none &none &none &none &none &bootloader &bootloader &none &none &none &none &none + &trans &trans &trans &trans &trans &sys_reset &sys_reset &trans &trans &trans &kp RGUI &trans + >; + }; + nav_layer { + bindings = < + &none &none &none &none &none &none &kp K_BACK &kp PG_DN &kp PG_UP &kp K_FORWARD &none &none + &none &none &none &none &none &none &kp LEFT &kp DOWN &kp UP &kp RIGHT &none &none + &trans &none &none &none &none &none &none &none &none &none &none &trans + &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &kp RGUI &trans + >; + }; + num_layer { + bindings = < + &none &kp F12 &kp F9 &kp F8 &kp F7 &none &kp FSLH &kp N7 &kp N8 &kp N9 &kp MINUS &kp BSPC + &none &kp F11 &kp F6 &kp F5 &kp F4 &none &kp STAR &kp N4 &kp N5 &kp N6 &kp PLUS &kp RET + &kp LSHFT &kp F10 &kp F3 &kp F2 &kp F1 &none &kp EQUAL &kp N1 &kp N2 &kp N3 &none &kp RSHFT + &kp LCTRL &kp LGUI &kp LALT &kp LSHFT &mo lower &trans &kp SPACE &kp N0 &kp N0 &kp DOT &none &kp RCTRL + >; + }; + }; +}; + +/ { + conditional_layers { + compatible = "zmk,conditional-layers"; + tri_layer { + if-layers = <1 2>; + then-layer = <3>; + }; + }; +}; + +/ { + behaviors { + lpar_lt: lpar_lt { compatible = "zmk,behavior-mod-morph"; #binding-cells = <0>; bindings = <&kp LPAR>, <&kp LT >; mods = <(MOD_LSFT|MOD_RSFT)>; }; + rpar_gt: rpar_gt { compatible = "zmk,behavior-mod-morph"; #binding-cells = <0>; bindings = <&kp RPAR>, <&kp GT >; mods = <(MOD_LSFT|MOD_RSFT)>; }; + /omit-if-no-ref/ td_reset: td_reset { + compatible = "zmk,behavior-tap-dance"; + #binding-cells = <0>; + tapping-term-ms = <175>; + bindings = <&sys_reset>, <&bootloader>; + }; + }; +}; + +#define COMBO2(k1,k2,a) combo_##k1##k2 { timeout-ms = <42>; key-positions = <k1 k2>; bindings = <a>; }; +#define COMBO3(k1,k2,k3,a) combo_##k1##k2##k3 { timeout-ms = <42>; key-positions = <k1 k2 k3>; bindings = <a>; }; +/ { + combos { + compatible = "zmk,combos"; + + // horizontal combos + COMBO2(LB3,LB2,&kp LC(INS)) COMBO2(LB2,LB1,&kp LS(INS)) + + COMBO2(RT1,RT2,&kp BSPC) COMBO2(RT2,RT3,&kp DEL) + COMBO2(RM1,RM2,&lpar_lt) COMBO2(RM2,RM3,&rpar_gt) COMBO2(RM3,RM4,&kp SQT) + COMBO2(RB1,RB2,&kp LBKT) COMBO2(RB2,RB3,&kp RBKT) + + COMBO3(RT5,RT4,RT3,&kp PRINTSCREEN) + + // vertical combos + COMBO2(LT5,LM5,&kp GRAVE) COMBO2(LT4,LM4,&kp EXCL ) COMBO2(LT3,LM3,&kp AT ) COMBO2(LT2,LM2,&kp HASH ) COMBO2(LT1,LM1,&kp DLLR ) COMBO2(LT0,LM0,&kp PRCNT) + COMBO2(LM3,LB3,&kp GRAVE) COMBO2(LM2,LB2,&kp BSLH ) COMBO2(LM1,LB1,&kp EQUAL) COMBO2(LM0,LB0,&kp TILDE) + + COMBO2(RT0,RM0,&kp CARET) COMBO2(RT1,RM1,&kp PLUS ) COMBO2(RT2,RM2,&kp STAR ) COMBO2(RT3,RM3,&kp AMPS ) COMBO2(RT4,RM4,&kp SQT ) + COMBO2(RM0,RB0,&kp UNDER) COMBO2(RM1,RB1,&kp MINUS) COMBO2(RM2,RB2,&kp FSLH ) COMBO2(RM3,RB3,&kp PIPE ) COMBO2(RM4,RB4,&kp EXCL ) + + COMBO3(LT5,LM5,LB5,&td_reset) + COMBO3(RT5,RM5,RB5,&td_reset) + }; +}; + +&mt { + tapping-term-ms = <175>; + flavor = "tap-preferred"; +}; + +< { + tapping-term-ms = <175>; + flavor = "tap-preferred"; +}; @@ -1,5 +1,21 @@ { "nodes": { + "hanck": { + "flake": false, + "locked": { + "lastModified": 1730918338, + "narHash": "sha256-k26oBBHxN22Ng93DVZi3XxdrutF+VlwY5148T5uOHaQ=", + "ref": "refs/heads/master", + "rev": "4a3cddf9741c6c26cdf9c06052faf5bed305f781", + "revCount": 17, + "type": "git", + "url": "https://cgit.krebsco.de/hanck" + }, + "original": { + "type": "git", + "url": "https://cgit.krebsco.de/hanck" + } + }, "nixpkgs": { "locked": { "lastModified": 1730831018, @@ -18,10 +34,28 @@ }, "root": { "inputs": { + "hanck": "hanck", "nixpkgs": "nixpkgs", + "zmk-helpers": "zmk-helpers", "zmk-nix": "zmk-nix" } }, + "zmk-helpers": { + "flake": false, + "locked": { + "lastModified": 1729650883, + "narHash": "sha256-fKqp3sr6+ZmFLXwTXE7Ge9n7F6sy5mDakulJNvucy+I=", + "owner": "urob", + "repo": "zmk-helpers", + "rev": "230c7e18ee3c82325352287db29b59f53f20fa2a", + "type": "github" + }, + "original": { + "owner": "urob", + "repo": "zmk-helpers", + "type": "github" + } + }, "zmk-nix": { "inputs": { "nixpkgs": [ @@ -6,9 +6,19 @@ url = "github:lilyinstarlight/zmk-nix"; inputs.nixpkgs.follows = "nixpkgs"; }; + + zmk-helpers = { + url = "github:urob/zmk-helpers"; + flake = false; + }; + + hanck = { + url = "git+https://cgit.krebsco.de/hanck"; + flake = false; + }; }; - outputs = { self, nixpkgs, zmk-nix }: let + outputs = { self, nixpkgs, zmk-nix, zmk-helpers, hanck }: let forAllSystems = nixpkgs.lib.genAttrs (nixpkgs.lib.attrNames zmk-nix.packages); in { packages = forAllSystems (system: rec { @@ -20,10 +30,14 @@ src = nixpkgs.lib.sourceFilesBySuffices self [ ".board" ".cmake" ".conf" ".defconfig" ".dts" ".dtsi" ".json" ".keymap" ".overlay" ".shield" ".yml" "_defconfig" ]; board = "nice_nano_v2"; - shield = "lily58_%PART%"; + shield = "hanck_duo_%PART%"; zephyrDepsHash = "sha256-9xdpgu0/A2ZWmJNSlyQ172MGCnkOf/A8WLYp7dvjJ5A="; + extraCmakeFlags = [ + "-DZMK_EXTRA_MODULES=${hanck}/zmk;${zmk-helpers}" + ]; + meta = { description = "ZMK firmware"; license = nixpkgs.lib.licenses.mit; |