summaryrefslogtreecommitdiffstats
path: root/keyboards/ergodox_infinity/keymaps/not-quite-neo/keymap.c
blob: 8cf51842a23a03d09dab4668af876801f6114148 (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
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
#include QMK_KEYBOARD_H

/*
NQN is not-quite-neo
A layout based on neo2
*/

#include "action_layer.h"
#include "version.h"

#include "nqn-keys-on-quertz-de-latin1.h"
#include "nqn-basic-layout.h"

// Since our quirky block definitions are basically a list of comma separated 
// arguments, we need a wrapper in order for these definitions to be 
// expanded before being used as arguments to the LAYOUT_xxx macro.
#define LAYOUT_ergodox_wrapper(...) LAYOUT_ergodox(__VA_ARGS__)

#ifdef LEADER_TIMEOUT
#undef LEADER_TIMEOUT
#endif
#define LEADER_TIMEOUT 300

#define TAP_ONCE(code)  \
  register_code (code); \
  unregister_code (code)


// Automatic number generation of important keywords
enum my_keycodes{
    // Layer numbers follow the neo2 terminology, i.e. base layer = layer 1
    L01 = 0,
    /* L02, SHIFT is not (yet) implemented as a fully customizable layer */
    L03,
    L04,
    L05,
    /* L06, UNSPECIFIED not (yet) needed */
    LFN
};


const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* L01 -> default: BASE LAYER
 * ,--------------------------------------------------.           ,--------------------------------------------------.
 * | TAB    |   1  |   2  |   3  |   4  |   5  |      |           |      |   6  |   7  |   8  |   9  |   0  | BACKSP |
 * |--------+------+------+------+------+-------------|           |------+------+------+------+------+------+--------|
 * | ESC    |                                  | LEADR|           | LEADR|                                  | ENTER  |
 * |--------+                                  |      |           |      |                                  +--------|
 * | L03    |             L01_LEFT             |------|           |------|             L01_RIGHT            | L03    |
 * |--------+                                  | LFN  |           | LFN  |                                  +--------|
 * | SHIFT  |                                  |      |           |      |                                  | SHIFT  |
 * `--------+------+------+------+------+-------------'           `-------------+------+------+------+------+--------'
 *   | CTRL | GUI  | ALT  | L05  | L04  |                                       | L04  | L05  | ALTGR| LFN  | CTRL |
 *   `----------------------------------'                                       `----------------------------------'
 *                                        ,-------------.       ,-------------.
 *                                        | HOME | END  |       | LEFT | RIGHT|
 *                                 ,------|------|------|       |------+------+------.
 *                                 |      |      | PGUP |       | UP   |      |      |
 *                                 | SPACE| SHIFT|------|       |------| SHIFT| SPACE|
 *                                 |      |      | PGDN |       | DOWN |      |      |
 *                                 `--------------------'       `--------------------'
 */
[L01] = LAYOUT_ergodox_wrapper(
  KC_TAB,  KC_1,   KC_2,    KC_3,    KC_4,    KC_5,    XXXXXXX,
  KC_ESC,                 L01_LEFT_01,                 KC_LEAD,
  MO(L03),                L01_LEFT_02,
  KC_LSHIFT,              L01_LEFT_03,                 MO(LFN),
  KC_LCTRL,KC_LGUI,KC_LALT, MO(L05), MO(L04),
                                              XXXXXXX, XXXXXXX,
                                                       KC_PGUP,
                                     KC_SPACE,KC_LSHIFT,KC_PGDN,
  //--
  XXXXXXX,  KC_6,   KC_7,    KC_8,    KC_9,    KC_0,    KC_BSPACE,
  KC_LEAD,                L01_RIGHT_01,                 KC_ENTER,
                          L01_RIGHT_02,                 MO(L03),
  MO(LFN),                L01_RIGHT_03,                 KC_RSHIFT,
                    MO(L04), MO(L05), KC_RALT, MO(LFN), KC_RCTRL,
  KC_LEFT, KC_RIGHT,
  KC_UP,
  KC_DOWN, KC_RSHIFT, KC_SPACE
),


/*
L02 -> MO(L02): SHIFT (as a layer not used, not defined, not reachable)
 */


/* L03 -> MO(L03): PROGRAMMING
 * ,--------------------------------------------------.           ,--------------------------------------------------.
 * |        |      |      |      |      |      |      |           |      |      |      |      |      |      |        |
 * |--------+------+------+------+------+-------------|           |------+------+------+------+------+------+--------|
 * |        |                                  |      |           |      |                                  |        |
 * |--------+                                  |      |           |      |                                  +--------|
 * |        |             L03_LEFT             |------|           |------|             L03_RIGHT            |        |
 * |--------+                                  |      |           |      |                                  +--------|
 * |        |                                  |      |           |      |                                  |        |
 * `--------+------+------+------+------+-------------'           `-------------+------+------+------+------+--------'
 *   |      |      |      |      |      |                                       |      |      |      |      |      |
 *   `----------------------------------'                                       `----------------------------------'
 *                                        ,-------------.       ,-------------.
 *                                        |      |      |       |      |      |
 *                                 ,------|------|------|       |------+------+------.
 *                                 |      |      |      |       |      |      |      |
 *                                 |      |      |------|       |------|      |      |
 *                                 |      |      |      |       |      |      |      |
 *                                 `--------------------'       `--------------------'
 */
[L03] = LAYOUT_ergodox_wrapper(
  _______, _______, _______, _______, _______, _______, _______,
  _______,                 L03_LEFT_01,                 _______,
  _______,                 L03_LEFT_02,
  _______,                 L03_LEFT_03,                 _______,
  _______, _______, _______, _______, _______,
                                               _______, _______,
                                                        _______,
                                      _______, _______, _______,
  //--
  _______, _______, _______, _______, _______, _______, _______,
  _______,                 L03_RIGHT_01,                _______,
                           L03_RIGHT_02,                _______,
  _______,                 L03_RIGHT_03,                _______,
                    _______, _______, _______, _______, _______,
  _______, _______,
  _______,
  _______, _______, _______
),

/* L04 -> MO(L04): NAVIGATION AND NUMBERS
 * ,--------------------------------------------------.           ,--------------------------------------------------.
 * |        |      |      |      |      |      |      |           |      |      |      |      |      |      |        |
 * |--------+------+------+------+------+-------------|           |------+------+------+------+------+------+--------|
 * |        |                                  |      |           |      |                                  |        |
 * |--------+                                  |      |           |      |                                  +--------|
 * |        |             L04_LEFT             |------|           |------|             L04_RIGHT            |        |
 * |--------+                                  |      |           |      |                                  +--------|
 * |        |                                  |      |           |      |                                  |        |
 * `--------+------+------+------+------+-------------'           `-------------+------+------+------+------+--------'
 *   |      |      |      |      |      |                                       |      |      |      |      |      |
 *   `----------------------------------'                                       `----------------------------------'
 *                                        ,-------------.       ,-------------.
 *                                        |      |      |       |      |      |
 *                                 ,------|------|------|       |------+------+------.
 *                                 |      |      |      |       |      |      |      |
 *                                 | 0    |      |------|       |------|      | 0    |
 *                                 |      |      |      |       |      |      |      |
 *                                 `--------------------'       `--------------------'
 */
[L04] = LAYOUT_ergodox_wrapper(
  _______, _______, _______, _______, _______, _______, _______,
  _______,                 L04_LEFT_01,                 _______,
  _______,                 L04_LEFT_02,
  _______,                 L04_LEFT_03,                 _______,
  _______, _______, _______, _______, _______,
                                               _______, _______,
                                                        _______,
                                      KC_0,    _______, _______,
  //--
  _______, _______, _______, _______, _______, _______, _______,
  _______,                 L04_RIGHT_01,                _______,
                           L04_RIGHT_02,                _______,
  _______,                 L04_RIGHT_03,                _______,
                    _______, _______, _______, _______, _______,
  _______, _______,
  _______,
  _______, _______, KC_0
),


/* L05 -> MO(L05): ALTERNATE
 * ,--------------------------------------------------.           ,--------------------------------------------------.
 * |        |      |      |      |      |      |      |           |      |      |      |      |      |      |        |
 * |--------+------+------+------+------+-------------|           |------+------+------+------+------+------+--------|
 * |        |                                  |      |           |      |                                  |        |
 * |--------+                                  |      |           |      |                                  +--------|
 * |        |             L05_LEFT             |------|           |------|             L05_RIGHT            |        |
 * |--------+                                  |      |           |      |                                  +--------|
 * |        |                                  |      |           |      |                                  |        |
 * `--------+------+------+------+------+-------------'           `-------------+------+------+------+------+--------'
 *   |      |      |      |      |      |                                       |      |      |      |      |      |
 *   `----------------------------------'                                       `----------------------------------'
 *                                        ,-------------.       ,-------------.
 *                                        |      |      |       |      |      |
 *                                 ,------|------|------|       |------+------+------.
 *                                 |      |      |      |       |      |      |      |
 *                                 |      |      |------|       |------|      |      |
 *                                 |      |      |      |       |      |      |      |
 *                                 `--------------------'       `--------------------'
 */
[L05] = LAYOUT_ergodox_wrapper(
  _______, _______, _______, _______, _______, _______, _______,
  _______,                 L05_LEFT_01,                 _______,
  _______,                 L05_LEFT_02,
  _______,                 L05_LEFT_03,                 _______,
  _______, _______, _______, _______, _______,
                                               _______, _______,
                                                        _______,
                                      _______, _______, _______,
  //--
  _______, _______, _______, _______, _______, _______, _______,
  _______,                 L05_RIGHT_01,                _______,
                           L05_RIGHT_02,                _______,
  _______,                 L05_RIGHT_03,                _______,
                    _______, _______, _______, _______, _______,
  _______, _______,
  _______,
  _______, _______, _______
),


/*
L06 -> <TBD>: UNSPECIFIED
*/


/* LFN -> MO(FN): FUNCTION
 * ,--------------------------------------------------.           ,--------------------------------------------------.
 * | RESET  |      |      |      |      |      |      |           |      |      |      |      |      |      | RESET  |
 * |--------+------+------+------+------+-------------|           |------+------+------+------+------+------+--------|
 * |        |                                  |      |           |      |                                  | BACKSPC|
 * |--------+                                  |      |           |      |                                  +--------|
 * |        |             L06_LEFT             |------|           |------|             L06_RIGHT            | INSERT |
 * |--------+                                  |      |           |      |                                  +--------|
 * |        |                                  |      |           |      |                                  | DELETE |
 * `--------+------+------+------+------+-------------'           `-------------+------+------+------+------+--------'
 *   |      |      |      |      |      |                                       | VOL+ | VOL- | MUTE |      |      |
 *   `----------------------------------'                                       `----------------------------------'
 *                                        ,-------------.       ,-------------.
 *                                        |      |      |       |      |      |
 *                                 ,------|------|------|       |------+------+------.
 *                                 |      |      |      |       |      |      |      |
 *                                 |      |      |------|       |------|      |      |
 *                                 |      |      |      |       |      |      |      |
 *                                 `--------------------'       `--------------------'
 */
[LFN] = LAYOUT_ergodox_wrapper(
  RESET,   _______, _______, _______, _______, _______, _______,
  _______,                 L06_LEFT_01,                 _______,
  _______,                 L06_LEFT_02,
  _______,                 L06_LEFT_03,                 _______,
  _______, _______, _______, _______, _______,
                                               _______, _______,
                                                        _______,
                                      _______, _______, _______,
  //--
  _______, _______, _______, _______, _______, _______, RESET,
  _______,                 L06_RIGHT_01,                KC_BSPACE,
                           L06_RIGHT_02,                KC_INSERT,
  _______,                 L06_RIGHT_03,                KC_DELETE,
                    KC_VOLU, KC_VOLD, KC_MUTE, _______, _______,
  _______, _______,
  _______,
  _______, _______, _______
)

};


// Runs just one time when the keyboard initializes.
void matrix_init_user(void) {
  set_unicode_input_mode(UC_LNX);
};


LEADER_EXTERNS();

// Runs constantly in the background, in a loop.
void matrix_scan_user(void) {
  LEADER_DICTIONARY() {
    leading = false;
    leader_end();

    SEQ_ONE_KEY (KC_1) {
      // ¯\_(ツ)_/¯
      unicode_input_start(); register_hex(0xaf); unicode_input_finish();
      register_code (KC_RALT); TAP_ONCE (KC_MINS); unregister_code (KC_RALT);
      register_code (KC_RSFT); TAP_ONCE (KC_8); unregister_code (KC_RSFT);
      unicode_input_start (); register_hex(0x30c4); unicode_input_finish();
      register_code (KC_RSFT); TAP_ONCE (KC_9); TAP_ONCE(KC_7); unregister_code (KC_RSFT);
      unicode_input_start (); register_hex(0xaf); unicode_input_finish();
    }

    SEQ_ONE_KEY (KC_2) {
      // 凸(ツ)凸
      unicode_input_start(); register_hex(0x51F8); unicode_input_finish();
      register_code (KC_RSFT); TAP_ONCE (KC_8); unregister_code (KC_RSFT);
      unicode_input_start (); register_hex(0x30c4); unicode_input_finish();
      register_code (KC_RSFT); TAP_ONCE (KC_9); unregister_code (KC_RSFT);
      unicode_input_start (); register_hex(0x51F8); unicode_input_finish();
    }
  }
}