zmk/config/cradio.keymap
2023-09-30 21:27:49 +05:30

235 lines
8.6 KiB
Plaintext

/*
* Copyright (c) 2020 The ZMK Contributors
*
* SPDX-License-Identifier: MIT
*/
#include <behaviors.dtsi>
#include <dt-bindings/zmk/keys.h>
#include <dt-bindings/zmk/bt.h>
#include <dt-bindings/zmk/keys.h>
#include <dt-bindings/zmk/outputs.h>
#include <behaviors.dtsi>
#define COLEMAK 0
#define NAV 1
#define NUM 2
#define SYM 3
#define FUN 4
/* krita base */
#define KRB 5
/* play */
#define PLAY 6
&mt {
flavor = "tap-preferred";
tapping_term_ms = <200>;
quick_tap_ms = <75>;
};
#define ZMK_HELPER_STRINGIFY(x) #x
/* ZMK_BEHAVIOR */
#define ZMK_BEHAVIOR_CORE_caps_word compatible = "zmk,behavior-caps-word"; #binding-cells = <0>
#define ZMK_BEHAVIOR_CORE_dynamic_macro compatible = "zmk,behavior-dynamic-macro"; #binding-cells = <1>
#define ZMK_BEHAVIOR_CORE_hold_tap compatible = "zmk,behavior-hold-tap"; #binding-cells = <2>
#define ZMK_BEHAVIOR_CORE_key_repeat compatible = "zmk,behavior-key-repeat"; #binding-cells = <0>
#define ZMK_BEHAVIOR_CORE_macro compatible = "zmk,behavior-macro"; #binding-cells = <0>
#define ZMK_BEHAVIOR_CORE_macro_one_param compatible = "zmk,behavior-macro-one-param"; #binding-cells = <1>
#define ZMK_BEHAVIOR_CORE_macro_two_param compatible = "zmk,behavior-macro-two-param"; #binding-cells = <2>
#define ZMK_BEHAVIOR_CORE_mod_morph compatible = "zmk,behavior-mod-morph"; #binding-cells = <0>
#define ZMK_BEHAVIOR_CORE_sticky_key compatible = "zmk,behavior-sticky-key"; #binding-cells = <1>
#define ZMK_BEHAVIOR_CORE_tap_dance compatible = "zmk,behavior-tap-dance"; #binding-cells = <0>
#define ZMK_BEHAVIOR_CORE_tri_state compatible = "zmk,behavior-tri-state"; #binding-cells = <0>
#define ZMK_BEHAVIOR(name, type, ...) \
/ { \
behaviors { \
name: name { \
label = ZMK_HELPER_STRINGIFY(ZB_ ## name); \
ZMK_BEHAVIOR_CORE_ ## type; \
__VA_ARGS__ \
}; \
}; \
};
#define KEYS_L 0 1 2 3 4 10 11 12 13 14 20 21 22 23 24
#define KEYS_R 5 6 7 8 9 15 16 17 18 19 25 26 27 28 29
#define THUMBS 30 31 32 33
/* left-hand HRMs */
ZMK_BEHAVIOR(ml, hold_tap,
flavor = "hold-preferred";
tapping-term-ms = <280>;
quick-tap-ms = <175>;
bindings = <&kp>, <&kp>;
hold-trigger-key-positions = <KEYS_R THUMBS>;
hold-trigger-on-release; // delay positional check until key-release
global-quick-tap;
)
/* right-hand HRMs */
ZMK_BEHAVIOR(mr, hold_tap,
flavor = "hold-preferred";
tapping-term-ms = <280>;
quick-tap-ms = <100>;
bindings = <&kp>, <&kp>;
hold-trigger-key-positions = <KEYS_L THUMBS>;
hold-trigger-on-release; // delay positional check until key-release
global-quick-tap;
)
/ {
combos {
compatible = "zmk,combos";
combo_caps_word {
timeout-ms = <100>;
key-positions = <20 29>;
bindings = <&caps_word>;
};
combo_esc {
timeout-ms = <150>;
key-positions = <12 13 16 17>;
bindings = <&kp ESC>;
};
// (
combo_lpar {
timeout-ms = <100>;
key-positions = <14 24>;
bindings = <&kp LPAR>;
};
// )
combo_rpar {
timeout-ms = <100>;
key-positions = <15 25>;
bindings = <&kp RPAR>;
};
// [
combo_lbrac {
timeout-ms = <100>;
key-positions = <13 23>;
bindings = <&kp LBRC>;
};
// ]
combo_rbrac {
timeout-ms = <100>;
key-positions = <16 26>;
bindings = <&kp RBRC>;
};
// <
combo_less_than {
timeout-ms = <100>;
key-positions = <3 13>;
bindings = <&kp LT>;
};
// >
combo_greater_than {
timeout-ms = <100>;
key-positions = <6 16>;
bindings = <&kp GT>;
};
combo_minus {
timeout-ms = <100>;
key-positions = <2 3 6 7>;
bindings = <&kp MINUS>;
};
combo_under {
timeout-ms = <100>;
key-positions = <22 23 26 27>;
bindings = <&kp UNDER>;
};
combo_ble {
timeout-ms = <20>;
key-positions = <0 1>;
bindings = <&out OUT_BLE>;
};
combo_krita {
timeout-ms = <100>;
key-positions = <0 10 20>;
bindings = <&tog KRB>;
};
combo_draw {
timeout-ms = <100>;
key-positions = <9 19 29>;
bindings = <&tog PLAY>;
};
};
keymap {
compatible = "zmk,keymap";
default_layer {
bindings = <
&kp Q &kp W &kp F &kp P &kp G &kp J &kp L &kp U &kp Y &kp SCLN
&ml LGUI A &ml LALT R &ml LSHIFT S &ml LCTRL T &ml LG(LA(LS(LCTRL))) D &mr LG(LA(LS(LCTRL))) H &mr LCTRL N &mr RSHIFT E &mr LALT I &mr LGUI O
&kp Z &kp X &kp C &kp V &kp B &kp K &kp M &kp CMMA &kp DOT &kp FSLH
&lt FUN TAB &lt NAV SPC &lt SYM RET &lt NUM LSHIFT
>;
};
nav_layer {
bindings = <
&bt BT_CLR &trans &trans &bootloader &sys_reset &trans &kp LBRC &kp RBRC &kp LPAR &kp RPAR
&bt BT_SEL 0 &trans &trans &trans &trans &kp LEFT &kp DOWN &kp UP &kp RIGHT &trans
&bt BT_SEL 1 &trans &trans &trans &trans &trans &kp LBKT &kp RBKT &trans &trans
&trans &trans &trans &kp BSPC
>;
};
num_layer {
bindings = <
&trans &kp F7 &kp F8 &kp F9 &trans &trans &trans &trans &trans &trans
&kp SQT &kp F4 &kp F5 &kp F6 &kp EQUAL &trans &trans &trans &trans &trans
&kp GRAVE &kp F1 &kp F2 &kp F3 &kp BSLH &trans &trans &trans &trans &trans
&trans &trans &trans &trans
>;
};
sym_layer {
bindings = <
&kp LS(Q) &kp LS(Z) &kp STAR &kp AMPS &trans &sys_reset &bootloader &trans &trans &trans
&kp DQT &kp CARET &kp PRCNT &kp DLLR &kp KP_PLUS &trans &trans &trans &trans &trans
&kp TILDE &kp HASH &kp AT &kp EXCL &kp PIPE &trans &trans &trans &trans &trans
&kp LPAR &kp RPAR &trans &trans
>;
};
fun_layer {
bindings = <
&trans &trans &trans &trans &trans &trans &kp N7 &kp N8 &kp N9 &trans
&trans &trans &trans &trans &trans &kp BSPC &kp N4 &kp N5 &kp N6 &trans
&trans &trans &trans &trans &trans &trans &kp N1 &kp N2 &kp N3 &trans
&trans &trans &trans &kp N0
>;
};
krita_base_layer {
bindings = <
&kp M &trans &kp BSLH &kp LBKT &kp RBKT &trans &trans &trans &trans &trans
&trans &trans &kp F &kp I &kp O &trans &trans &trans &trans &trans
&kp LC(S) &trans &kp P &kp K &kp L &trans &trans &trans &trans &trans
&kp LS(LC(Z)) &kp LC(Z) &trans &trans
>;
};
draw {
bindings = <
&kp Q &kp W &kp E &kp R &kp T &kp Y &kp U &kp I &kp O &kp P
&kp N1 &kp S &kp N3 &ml LCTRL F &kp G &kp H &mr LCTRL J &mr RSHIFT K &mr LALT L &mr LGUI SCLN
&kp Z &kp X &kp C &kp V &kp B &kp M &kp LEFT &kp DOWN &kp RIGHT &trans
&kp R &kp U &kp RET &kp BSPC
>;
};
};
};