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
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
|
/* Copyright 2015-2017 Jack Humbert
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include QMK_KEYBOARD_H
#include "muse.h"
bool is_lgui_active = false;
uint16_t lgui_timer = 0;
enum planck_layers { _COLEMAK, _LOWER, _RAISE, _EXTEND, _MACRO, _ADJUST };
enum planck_keycodes {
KI_BSPC = SAFE_RANGE,
KI_COMM,
KI_DOT,
KI_ESC,
KI_QUOT,
KI_SCLN,
KI_SLSH,
KI_TAB,
KI_A,
KI_B,
KI_C,
KI_D,
KI_E,
KI_F,
KI_G,
KI_H,
KI_I,
KI_J,
KI_K,
KI_L,
KI_M,
KI_N,
KI_O,
KI_P,
KI_Q,
KI_R,
KI_S,
KI_T,
KI_U,
KI_V,
KI_W,
KI_X,
KI_Y,
KI_Z,
KI_WLFT,
KI_WRGT,
KI_WUP,
KI_WDN
};
#define LOWER MO(_LOWER)
#define RAISE MO(_RAISE)
#define MACROS MO(_MACRO)
#define EXTEND MO(_EXTEND)
#define SPC_LOW LT(_LOWER, KC_SPC)
#define SPC_RAI LT(_RAISE, KC_SPC)
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* Colemak
* ,------------------------------------------------------------------------------------.
* | Tab | Q | W | F | P | G | J | L | U | Y | ; | Bksp |
* |------+------+------+------+------+-------+-------+------+------+------+------+------|
* | Esc | A | R | S | T | D | H | N | E | I | O | " |
* |------+------+------+------+------+-------+-------+------+------+------+------+------|
* | Shift| Z | X | C | V | B | K | M | , | . | / |Enter |
* |------+------+------+------+------+-------+-------+------+------+------+------+------|
* | Brite| Ctrl | Alt | GUI |Lower |SPC_LOW|SPC_RAI|Raise | Left | Down | Up |Right |
* `-------------------------------------------------------------------------------------'
*/
[_COLEMAK] = LAYOUT_planck_grid(
KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSPC,
EXTEND, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_QUOT,
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT,
MACROS, KC_LCTL, KC_LALT, KC_LGUI, LOWER, SPC_LOW, SPC_RAI, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT
),
/* Lower
* ,-----------------------------------------------------------------------------------.
* | ~ | ! | @ | # | $ | % | ^ | & | * | ( | ) | Bksp |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | | F1 | F2 | F3 | F4 | F5 | F6 | _ | + | { | } | | |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | | F7 | F8 | F9 | F10 | F11 | F12 |XXXXXX|XXXXXX| Home | End | |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | | | | | | | | | Next | Vol- | Vol+ | Play |
* `-----------------------------------------------------------------------------------'
*/
[_LOWER] = LAYOUT_planck_grid(
KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC,
_______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE,
_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, XXXXXXX, XXXXXXX, KC_HOME, KC_END, _______,
_______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY
),
/* Raise
* ,-----------------------------------------------------------------------------------.
* | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | Bksp |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | | F1 | F2 | F3 | F4 | F5 | F6 | - | = | [ | ] | \ |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | | F7 | F8 | F9 | F10 | F11 | F12 |XXXXXX|XXXXXX|Pg Up |Pg Dn | |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | | | | | | | | | Next | Vol- | Vol+ | Play |
* `-----------------------------------------------------------------------------------'
*/
[_RAISE] = LAYOUT_planck_grid(
KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC,
_______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS,
_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, XXXXXXX, XXXXXXX, KC_PGUP, KC_PGDN, _______,
_______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY
),
/* Extend
* ,-----------------------------------------------------------------------------------.
* | | Esc | WH_U | WBAK | WFWD | MS_U | PgUp | Home | Up | End | Del | Esc |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | | Alt | WH_D |Shift | Ctrl | MS_D | PgDn | Left | Down |Right | Bksp | Menu |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | WH_L | Undo | Cut | Copy |Paste |MS_B_1|MS_B_2|MS_B_3| MS_L | MS_R | WH_R | |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | | | | | | | | | | | | |
* `-----------------------------------------------------------------------------------'
*/
[_EXTEND] = LAYOUT_planck_grid(
_______, KC_ESC, KC_WH_U, KC_WBAK, KC_WFWD, KC_MS_U, KC_PGUP, KC_HOME, KC_UP, KC_END, KC_DEL, KC_ESC,
_______, KC_LALT, KC_WH_D, KC_LSFT, KC_LCTL, KC_MS_D, KC_PGDN, KC_LEFT, KC_DOWN, KC_RGHT, KC_BSPC, KC_APP,
KC_WH_L, KC_UNDO, KC_CUT, KC_COPY, KC_PSTE, KC_BTN1, KC_BTN2, KC_BTN3, KC_MS_L, KC_MS_R, KC_WH_R, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
),
/* Macros
* ,--------------------------------------------------------------------------------------.
* |KI_TAB| KI_Q | KI_W | KI_F | KI_P | KI_G | KI_J | KI_L | KI_U | KI_Y |KI_SCLN|KI_BSPC|
* |------+------+------+------+------+------+------+------+-------+------+-------+-------|
* |KI_ESC| KI_A | KI_R | KI_S | KI_T | KI_D | KI_H | KI_N | KI_E | KI_I | KI_O |KI_QUOT|
* |------+------+------+------+------+------+------+------+-------+------+-------+-------|
* | | KI_Z | KI_X | KI_C | KI_V | KI_B | KI_K | KI_M |KI_COMM|KI_DOT|KI_SLSH| |
* |------+------+------+------+------+------+------+------+-------+------+-------+-------|
* | | | | | | | | |KI_WLFT|KI_WDN|KI_WUP |KI_WGRT|
* `--------------------------------------------------------------------------------------'
*/
[_MACRO] = LAYOUT_planck_grid(
KI_TAB, KI_Q, KI_W, KI_F, KI_P, KI_G, KI_J, KI_L, KI_U, KI_Y, KI_SCLN, KI_BSPC,
KI_ESC, KI_A, KI_R, KI_S, KI_T, KI_D, KI_H, KI_N, KI_E, KI_I, KI_O, KI_QUOT,
_______, KI_Z, KI_X, KI_C, KI_V, KI_B, KI_K, KI_M, KI_COMM, KI_DOT, KI_SLSH, _______,
_______, _______, _______, _______, _______, _______, _______, _______, KI_WLFT, KI_WDN, KI_WUP, KI_WRGT
),
/* Adjust (Lower + Raise)
* ,-----------------------------------------------------------------------------------.
* | | Reset| Debug| | | | | | | | | |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | | | | | |AGnorm|AGswap| |Colemk| | | |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | | | | | | | |TermOn|TrmOff| | | |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | | | | | | | | | | | | |
* `-----------------------------------------------------------------------------------'
*/
[_ADJUST] = LAYOUT_planck_grid(
_______, RESET, DEBUG, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, AG_NORM, AG_SWAP, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, TERM_ON, TERM_OFF, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
)
};
layer_state_t layer_state_set_user(layer_state_t state) { return update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST); }
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode)
//
// Non-Alpha Macros
//
// 'Backspace' Macro
case KI_BSPC:
if (record->event.pressed) {
// Reserved for future use
//SEND_STRING("RESERVED Backspace");
} else {
}
return false; // Skip all further processing of this key
break;
// 'Comma' Macro
case KI_COMM:
if (record->event.pressed) {
// Reserved for future use
//SEND_STRING("RESERVED Comma");
} else {
}
return false; // Skip all further processing of this key
break;
// 'Dot' Macro
case KI_DOT:
if (record->event.pressed) {
// Reserved for future use
//SEND_STRING("RESERVED Dot");
} else {
}
return false; // Skip all further processing of this key
break;
// 'Escape' Macro
case KI_ESC:
if (record->event.pressed) {
// Reserved for future use
//SEND_STRING("RESERVED Escape");
} else {
}
// 'Quote' Macro
case KI_QUOT:
if (record->event.pressed) {
// Reserved for future use
//SEND_STRING("RESERVED Quote");
} else {
}
return false; // Skip all further processing of this key
break;
// 'Semicolon' Macro
case KI_SCLN:
if (record->event.pressed) {
// Reserved for future use
//SEND_STRING("RESERVED Semicolon");
} else {
}
return false; // Skip all further processing of this key
break;
// 'Slash' Macro
case KI_SLSH:
if (record->event.pressed) {
// Reserved for future use
//SEND_STRING("RESERVED Slash");
} else {
}
return false; // Skip all further processing of this key
break;
// 'Tab' Macro
case KI_TAB:
if (record->event.pressed) {
// Reserved for future use
//SEND_STRING("RESERVED Tab");
} else {
}
return false; // Skip all further processing of this key
break;
//
// Alpha Macros
//
// 'A' Macro
case KI_A:
if (record->event.pressed) {
// Reserved for future use
//SEND_STRING("RESERVED A");
} else {
}
return false; // Skip all further processing of this key
break;
// 'B' Macro
case KI_B:
if (record->event.pressed) {
// Reserved for future use
//SEND_STRING("RESERVED B");
} else {
}
return false; // Skip all further processing of this key
break;
// 'C' Macro
case KI_C:
if (record->event.pressed) {
// Reserved for future use
//SEND_STRING("RESERVED C");
} else {
}
return false; // Skip all further processing of this key
break;
// 'D' Macro
case KI_D:
if (record->event.pressed) {
// Reserved for future use
//SEND_STRING("RESERVED D");
} else {
}
return false; // Skip all further processing of this key
break;
// 'E' Macro
case KI_E:
if (record->event.pressed) {
// Reserved for future use
//SEND_STRING("RESERVED E");
} else {
}
return false; // Skip all further processing of this key
break;
// 'F' Macro
case KI_F:
if (record->event.pressed) {
// Reserved for future use
//SEND_STRING("RESERVED F");
} else {
}
return false; // Skip all further processing of this key
break;
// 'G' Macro
case KI_G:
if (record->event.pressed) {
// Reserved for future use
//SEND_STRING("RESERVED G");
} else {
}
return false; // Skip all further processing of this key
break;
// 'H' Macro
case KI_H:
if (record->event.pressed) {
// Reserved for future use
//SEND_STRING("RESERVED H");
} else {
}
return false; // Skip all further processing of this key
break;
// 'I' Macro
case KI_I:
if (record->event.pressed) {
// Reserved for future use
//SEND_STRING("RESERVED I");
} else {
}
return false; // Skip all further processing of this key
break;
// 'J' Macro
case KI_J:
if (record->event.pressed) {
// Reserved for future use
//SEND_STRING("RESERVED J");
} else {
}
return false; // Skip all further processing of this key
break;
// 'K' Macro
case KI_K:
if (record->event.pressed) {
// Reserved for future use
//SEND_STRING("RESERVED K");
} else {
}
return false; // Skip all further processing of this key
break;
// 'L' Macro
case KI_L:
if (record->event.pressed) {
// Reserved for future use
//SEND_STRING("RESERVED L");
} else {
}
return false; // Skip all further processing of this key
break;
// 'M' Macro
case KI_M:
if (record->event.pressed) {
// Reserved for future use
//SEND_STRING("RESERVED M");
} else {
}
return false; // Skip all further processing of this key
break;
// 'N' Macro
case KI_N:
if (record->event.pressed) {
// Reserved for future use
//SEND_STRING("RESERVED N");
} else {
}
return false; // Skip all further processing of this key
break;
// 'O' Macro
case KI_O:
if (record->event.pressed) {
// Reserved for future use
//SEND_STRING("RESERVED O");
} else {
}
return false; // Skip all further processing of this key
break;
// 'P' Macro
case KI_P:
if (record->event.pressed) {
// Reserved for future use
//SEND_STRING("RESERVED P");
} else {
}
return false; // Skip all further processing of this key
break;
// 'Q' Macro
case KI_Q:
if (record->event.pressed) {
// Reserved for future use
//SEND_STRING("RESERVED Q");
} else {
}
return false; // Skip all further processing of this key
break;
// 'R' Macro
case KI_R:
if (record->event.pressed) {
// Reserved for future use
//SEND_STRING("RESERVED R");
} else {
}
return false; // Skip all further processing of this key
break;
// 'S' Macro
case KI_S:
if (record->event.pressed) {
// Reserved for future use
//SEND_STRING("RESERVED S");
} else {
}
return false; // Skip all further processing of this key
break;
// 'T' Macro
case KI_T:
if (record->event.pressed) {
// Reserved for future use
//SEND_STRING("RESERVED T");
} else {
}
return false; // Skip all further processing of this key
break;
// 'U' Macro
case KI_U:
if (record->event.pressed) {
// Reserved for future use
//SEND_STRING("RESERVED U");
} else {
}
return false; // Skip all further processing of this key
break;
// 'V' Macro
case KI_V:
if (record->event.pressed) {
// Reserved for future use
//SEND_STRING("RESERVED V");
} else {
}
return false; // Skip all further processing of this key
break;
// 'W' Macro
case KI_W:
if (record->event.pressed) {
// Reserved for future use
//SEND_STRING("RESERVED W");
} else {
}
return false; // Skip all further processing of this key
break;
// 'X' Macro
case KI_X:
if (record->event.pressed) {
// Reserved for future use
//SEND_STRING("RESERVED X");
} else {
}
return false; // Skip all further processing of this key
break;
// 'Y' Macro
case KI_Y:
if (record->event.pressed) {
// Reserved for future use
//SEND_STRING("RESERVED Y");
} else {
}
return false; // Skip all further processing of this key
break;
// 'Z' Macro
case KI_Z:
if (record->event.pressed) {
// Reserved for future use
//SEND_STRING("RESERVED Z");
} else {
}
return false; // Skip all further processing of this key
break;
//
// Arrow key macros
//
// Windows Win+Left tap to move window without resetting KC_LGUI
// Additional code is in matrix_scan_user()
case KI_WLFT:
if (record->event.pressed) {
if (!is_lgui_active) {
is_lgui_active = true;
register_code(KC_LGUI);
}
lgui_timer = timer_read();
tap_code(KC_LEFT);
} else {
}
return false; // Skip all further processing of this key
break;
// Windows Win+Right tap to move window without resetting KC_LGUI
// Additional code is in matrix_scan_user()
case KI_WRGT:
if (record->event.pressed) {
if (!is_lgui_active) {
is_lgui_active = true;
register_code(KC_LGUI);
}
lgui_timer = timer_read();
tap_code(KC_RIGHT);
} else {
}
return false; // Skip all further processing of this key
break;
// Windows Win+Up tap to move window without resetting KC_LGUI
// Additional code is in matrix_scan_user()
case KI_WUP:
if (record->event.pressed) {
if (!is_lgui_active) {
is_lgui_active = true;
register_code(KC_LGUI);
}
lgui_timer = timer_read();
tap_code(KC_UP);
} else {
}
return false; // Skip all further processing of this key
break;
// Windows Win+Down tap to move window without resetting KC_LGUI
// Additional code is in matrix_scan_user()
case KI_WDN:
if (record->event.pressed) {
if (!is_lgui_active) {
is_lgui_active = true;
register_code(KC_LGUI);
}
lgui_timer = timer_read();
tap_code(KC_DOWN);
} else {
}
return false; // Skip all further processing of this key
break;
default:
return true; // Process all other keycodes normally
break;
}
return true;
}
void matrix_scan_user(void) {
// Check if KC_LGUI is active in KI_WLFT, KI_WRGT, KI_WUP
if (is_lgui_active) {
if (timer_elapsed(lgui_timer) > 1000) {
unregister_code(KC_LGUI);
is_lgui_active = false;
}
}
}
|