summaryrefslogtreecommitdiff
path: root/config/base.keymap
blob: 353a0dd2f5833860d3f126360682fded348bdec5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
// -*- mode: dts-mode; tab-width: 2 -*-
// Loosely based on https://github.com/urob/zmk-config/tree/main/config
#include <behaviors.dtsi>
#include <dt-bindings/zmk/keys.h>
#include <dt-bindings/zmk/bt.h>
#include <dt-bindings/zmk/mouse.h>

#define COMBO_TIMEOUT_MS 25

#define DV     0
#define QW     1
#define GAMING 2
#define LOW    3
#define UPR    4
#define NAV    5
#define MOUSE  6
#define QVLOW  7
#define GAMELOW 8
#define FN     9

#define SPACEKEY &layer_mo NAV SPACE

#define HL1(k) hm_left LGUI  k
#define HL2(k) hm_left LALT  k
#define HL3(k) hm_left LCTL  k
#define HL4(k) hm_left LSHFT k
#define HR1(k) hm_right LGUI  k
#define HR2(k) hm_right LALT  k
#define HR3(k) hm_right LCTL  k
#define HR4(k) hm_right LSHFT k

#include "extra_keys.h"

/ {
  behaviors {
    hm_left: homerow_modifiers_left {
      compatible = "zmk,behavior-hold-tap";
      flavor = "balanced";
      #binding-cells = <2>;
      tapping-term-ms = <280>;
      quick-tap-ms = <175>;
      require-prior-idle-ms = <150>;
      bindings = <&kp>, <&kp>;
      hold-trigger-key-positions = <RIGHT_KEYS THUMBS>;
      hold-trigger-on-release;
    };
    hm_right: homerow_modifiers_right {
      compatible = "zmk,behavior-hold-tap";
      flavor = "balanced";
      #binding-cells = <2>;
      tapping-term-ms = <280>;
      quick-tap-ms = <175>;
      require-prior-idle-ms = <150>;
      bindings = <&kp>, <&kp>;
      hold-trigger-key-positions = <LEFT_KEYS THUMBS>;
      hold-trigger-on-release;
    };
    layer_mo: layer_modifiers {
      compatible = "zmk,behavior-hold-tap";
      flavor = "balanced";
      #binding-cells = <2>;
      tapping-term-ms = <280>;
      quick-tap-ms = <175>;
      require-prior-idle-ms = <150>;
      bindings = <&mo>, <&kp>;
      hold-trigger-on-release;
    };
  };

  /* combos { */
    /*   compatible = "zmk,combos"; */

    /*   combo_q_c_x { */
      /*     timeout-ms = <COMBO_TIMEOUT_MS>; */
      /*     require-prior-idle-ms = <100>; */
      /*     key-positions = <LM1 LM2>; */
      /*     layers = <QW>; */
      /*     bindings = <&hm_left LS(LCTRL) LC(B)>; */
    /*   }; */

    /*   combo_q_c_c { */
      /*     timeout-ms = <COMBO_TIMEOUT_MS>; */
      /*     require-prior-idle-ms = <100>; */
      /*     key-positions = <LM3 LM2>; */
      /*     layers = <QW>; */
      /*     bindings = <&hm_left LA(LCTRL) LC(I)>; */
    /*   }; */

    /*   combo_d_c_x { */
      /*     timeout-ms = <COMBO_TIMEOUT_MS>; */
      /*     require-prior-idle-ms = <100>; */
      /*     key-positions = <LM1 LM2>; */
      /*     layers = <DV>; */
      /*     bindings = <&hm_left LS(LCTRL) LC(X)>; */
    /*   }; */

    /*   combo_d_c_c { */
      /*     timeout-ms = <COMBO_TIMEOUT_MS>; */
      /*     require-prior-idle-ms = <100>; */
      /*     key-positions = <LM3 LM2>; */
      /*     layers = <DV>; */
      /*     bindings = <&hm_left LA(LCTRL) LC(C)>; */
    /*   }; */

    /*   combo_tab { */
      /*     timeout-ms = <COMBO_TIMEOUT_MS>; */
      /*     require-prior-idle-ms = <100>; */
      /*     key-positions = <LT3 LT2>; */
      /*     layers = <DV QW LOW UPR QVLOW>; */
      /*     bindings = <&kp TAB>; */
    /*   }; */

    /*   combo_ret { */
      /*     timeout-ms = <COMBO_TIMEOUT_MS>; */
      /*     require-prior-idle-ms = <100>; */
      /*     key-positions = <RM1 RM2>; */
      /*     layers = <DV QW LOW UPR QVLOW>; */
      /*     bindings = <&hm_right LS(LCTRL) RET>; */
    /*   }; */

    /*   combo_bspc { */
      /*     timeout-ms = <COMBO_TIMEOUT_MS>; */
      /*     require-prior-idle-ms = <100>; */
      /*     key-positions = <RT1 RT2>; */
      /*     layers = <DV QW LOW UPR QVLOW>; */
      /*     bindings = <&kp BSPC>; */
    /*   }; */
    /*   combo_del { */
      /*     timeout-ms = <COMBO_TIMEOUT_MS>; */
      /*     require-prior-idle-ms = <100>; */
      /*     key-positions = <RT2 RT3>; */
      /*     layers = <DV QW LOW UPR QVLOW>; */
      /*     bindings = <&kp DEL>; */
    /*   }; */
  /* } ; */

  conditional_layers {
    compatible = "zmk,conditional-layers";
    fn_layer {
      if-layers = <LOW UPR>;
      then-layer = <FN>;
    };
    qwlow_layer {
      if-layers = <QW LOW>;
      then-layer = <QVLOW>;
    };
    gamelow_layer {
      if-layers = <GAMING LOW>;
      then-layer = <GAMELOW>;
    };
  };

  keymap {
    compatible = "zmk,keymap";

    default_layer {
      display-name = "DVORAK";
      // DV - Dvorak layer
      bindings = <
      R1X  &kp SQT     &kp COMMA &kp DOT  &kp P    &kp Y    R1Y &kp F  &kp G    &kp C    &kp R    &kp L R1Z
      R2X  &HL1(A)     &HL2(O)   &HL3(E)  &HL4(U)  &kp I    R2Y &kp D  &HR4(H)  &HR3(T)  &HR2(N)  &HR1(S) R2Z
      R3X  &kp SEMI    &kp Q     &kp   J  &kp K    &kp X    R3Y &kp B  &kp M    &kp W    &kp V    &kp Z R3Z
      R4X  &mo LOW &kp LSHIFT R4Y SPACEKEY &mo UPR R4Z
      >;
    };

    dvorak_layer {
      display-name = "QWERTY";
      // This is a "QWERTY" keymap, but it's really intended to be used in dvorak mode
      // (with setxkbmap us -variant dvorak -option compose:ralt).
      bindings = <
      R1X  &kp Q       &kp W    &kp E          &kp R    &kp T  R1Y &kp Y  &kp U    &kp I      &kp O    &kp P    R1Z
      R2X  &HL1(A)     &HL2(S)  &HL3(D)        &HL4(F)  &kp G  R2Y &kp H  &HR4(J)  &HR3(K)    &HR2(L)  &HR1(SEMI) R2Z
      R3X  &kp Z       &kp X    &kp C          &kp V    &kp B  R3Y &kp N  &kp M    &kp COMMA  &kp DOT  &kp SLASH  R3Z
      R4X  &mo LOW &kp LSHIFT R4Y SPACEKEY &mo UPR R4Z
      >;
    };

    gaming_layer {
      display-name = "GAMING";
      bindings = <
      R1X  &kp Q  &kp W  &kp E  &kp R  &kp T R1Y  &kp Y  &kp U  &kp I      &kp O    &kp P    R1Z
      R2X  &kp A  &kp S  &kp D  &kp F  &kp G R2Y  &kp H  &kp J  &kp K      &kp L    &kp SEMI R2Z
      R3X  &kp Z  &kp X  &kp C  &kp V  &kp B R3Y  &kp N  &kp M  &kp COMMA  &kp DOT  &kp SLASH  R3Z
      R4X  &mo LOW &kp LSHIFT R4Y SPACEKEY &mo UPR R4Z
      >;
    };

    lower_layer {
      display-name = "lower";
      bindings = <
      R1X  &kp EXCL   &kp AT     &kp HASH  &kp DLLR   &kp PRCNT R1Y  &kp CARET  &kp AMPS   &kp STAR   &kp LPAR  &kp RPAR    R1Z
      R2X  &kp LGUI   &kp LALT   &kp LCTL  &kp LSHFT  &kp BSLH  R2Y  &kp FSLH   &kp UNDER  &kp PLUS   &kp LBRC  &kp RBRC    R2Z
      R3X  &kp GRAVE  &kp TILDE  &kp TAB   &kp ESC    &kp PIPE  R3Y  &kp QMARK  &kp MINUS  &kp EQUAL  &kp LBKT  &kp RBKT R3Z
      R4X &trans &trans SPACEKEY R4Y &trans &trans R4Z
      >;
    };

    raise_layer {
      display-name = "raise";
      bindings = <
      R1X  &kp N1  &kp N2  &kp N3  &kp N4  &kp N5 R1Y  &kp N6    &kp N7     &kp N8    &kp N9    &kp N0 R1Z
      R2X  &trans  &trans  &trans  &trans  &trans R2Y  &kp BSPC  &kp LSHFT  &kp LCTL  &kp LALT  &kp LGUI R2Z
      R3X  &trans  &trans  &trans  &trans  &trans R3Y  &kp RALT  &kp RET    &kp DEL   &trans    &trans R3Z

      R4X &trans &trans SPACEKEY R4Y TX &trans &trans R4Z
      >;
    };

    navigation_layer {
      display-name = "nav";
      bindings = <
      R1X  &mkp MB4  &mkp MB3  &mkp MB2  &mkp MB1  &trans R1Y  &trans  &trans    &trans     &trans     &trans R1Z
      R2X  &trans    &trans    &trans    &trans    &trans R2Y  &trans  &kp LEFT  &kp DOWN   &kp UP     &kp RIGHT R2Z
      R3X  &trans    &trans    &trans    &trans    &trans R3Y  &trans  &kp HOME  &kp PG_DN  &kp PG_UP  &kp END R3Z

      R4X &trans &trans SPACEKEY R4Y TX &trans &trans R4Z
      >;
    };

    mouse_layer {
      // Waiting for https://github.com/zmkfirmware/zmk/pull/778
		  // Using fork at https://github.com/ftc/zmk/blob/mouse-ftc
      display-name = "mouse";
      bindings = <
      R1X  &trans    &trans    &trans    &trans    &trans R1Y  &trans  &trans    &trans    &trans  &trans R1Z
      R2X  &mkp MB4  &mkp MB3  &mkp MB2  &mkp MB1  &trans R2Y  &trans  &kp LEFT  &kp DOWN  &kp UP  &kp RIGHT R2Z
      R3X  &trans    &trans    &trans    &trans    &trans R3Y  &trans  &trans    &trans    &trans  &trans R3Z

      R4X &trans &trans SPACEKEY R4Y TX &trans &trans R4Z
      >;
    };

    qwerty_lower_layer {
      display-name = "lower";
      bindings = <
      R1X  &kp EXCL   &kp AT    &kp HASH  &kp DLLR   &kp PRCNT R1Y  &kp CARET  &kp AMPS  &kp STAR  &kp LPAR   &kp RPAR R1Z
      R2X  &kp LGUI   &kp LALT   &kp LCTL  &kp LSHFT  &kp BSLH  R2Y  &kp LBKT   &kp DQT   &kp RBRC  &kp UNDER  &kp PLUS R2Z
      R3X  &kp GRAVE  &kp TILDE  &kp TAB   &kp ESC    &kp PIPE  R3Y  &kp LBRC   &kp SQT   &kp RBKT  &kp MINUS  &kp EQUAL R3Z
      R4X &trans &trans SPACEKEY R4Y TX &trans &trans R4Z
      >;
    };

    gaming_lower_layer {
      display-name = "gaming";
      bindings = <
      R1X  &kp N1  &kp N2  &kp N3  &kp N4  &kp N9 R1Y  &trans  &trans  &trans  &trans  &trans R1Z
      R2X  &kp N5  &kp N6  &kp N7  &kp N8  &kp N0 R2Y  &trans  &trans  &trans  &trans  &trans R2Z
      R3X  &trans  &trans  &trans  &trans  &trans R3Y  &trans  &trans  &trans  &trans  &trans R3Z
      R4X &trans &trans SPACEKEY R4Y TX &trans &trans R4Z
      >;
    };

    function_layer {
      display-name = "fn";
      bindings = <
      R1X  &kp F1   &kp F2   &kp F3      &kp F4  &kp F5 R1Y  &kp F6  &kp F7  &kp F8  &kp F9  &kp F10 R1Z
      R2X  &kp F11  &kp F12  &to GAMING  &to DV  &to QW R2Y  &trans  &trans  &trans  &trans  &trans R2Z
      R3X FUNC_KEYS R3Z
      R4X &trans &trans SPACEKEY R4Y TX &trans &trans R4Z
      >;
    };

  };
};