-
Notifications
You must be signed in to change notification settings - Fork 1
/
keymap.c
3252 lines (2868 loc) · 105 KB
/
keymap.c
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
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#include QMK_KEYBOARD_H
#include "print.h"
// #include "ps2_mouse.h"
// #include "ps2.h"
enum corne_layers {
_BASIC,
_QWERTY,
_BASE,
_CONTROL,
_STENO,
_DATA,
_PROGRAM,
_SYMBOL,
_EDIT,
_MOUSE,
// _MOUSE_BTN,
_NUMPAD,
_UTILITY,
_TOUHOU,
};
enum custom_keycodes {
SELECT = SAFE_RANGE,
REP,
MAGIC,
NEWSENT,
ALTTAB,
BASIC,
BASE,
MENU,
CS_END,
CS_HOME,
MUTE,
MUTE_L,
MUTE_R,
CS_VOLD,
CS_VOLU,
CS_VALU,
CS_VALD,
CS_RGBN,
CS_RGBT,
CLOCKUP,
CLOCKDN,
CLOCKNX,
OLEDSAV,
OLEDTOG,
// Custom Symbols
COM_DOT,
QUE_EXL,
MINS_AT,
APO_QUO,
CS_COLN,
CS_UNDS,
CS_PIPE,
CS_LT,
CS_GT,
CS_PERC,
CS_ASTR,
CS_DLR,
CS_AMPR,
CS_CIRC,
CS_EXLM,
CS_TILD,
CS_PLUS,
CS_HASH,
CS_SLSH,
CS_EQL,
CS_AT,
CS_QUOT,
CS_DQUO,
CS_POUN,
CS_BSLS,
CS_MINS,
CS_DOT,
CS_COMM,
CS_QUES,
CS_SCLN,
// Bracket macros
CS_CBRS,
CS_PRNS,
CS_BRCS,
// Home block mods
CS_RBRC,
CS_RPRN,
CS_LPRN,
// Combos
CM_MOUSE,
DELWORD,
CTLBSPC,
SPC_DN,
JOIN,
SPC_UP,
};
// Home row mods
#define MT_A LGUI_T(KC_A)
#define MT_S LALT_T(KC_S)
#define MT_D LCTL_T(KC_D)
#define MT_F LSFT_T(KC_F)
#define MT_J RSFT_T(KC_J)
#define MT_K RCTL_T(KC_K)
#define MT_L LALT_T(KC_L)
#define MT_SCLN RGUI_T(KC_SCLN)
// Alt layout home row mods
#define MTA_N LGUI_T(KC_N)
#define MTA_R LALT_T(KC_R)
#define MTA_T LCTL_T(KC_T)
#define MTA_S LSFT_T(KC_S)
#define MTA_H RSFT_T(KC_H)
#define MTA_E RCTL_T(KC_E)
#define MTA_I LALT_T(KC_I)
#define MTA_A RGUI_T(KC_A)
// Symbol home row mods
#define MT_TILD LT(0,CS_TILD)
#define MT_UNDS LT(0,CS_UNDS)
#define MT_LPRN LT(0,CS_LPRN)
#define MT_RPRN LT(0,CS_RPRN)
#define MT_CIRC LT(0,CS_CIRC)
#define MT_PLUS LT(0,CS_PLUS)
#define MT_MINS LT(0,CS_MINS)
#define MT_EQL LT(0,CS_EQL)
#define MT_1 RSFT_T(KC_1)
#define MT_2 RCTL_T(KC_2)
#define MT_3 LALT_T(KC_3)
#define MT_PIPE LGUI_T(KC_PIPE)
#define MT_COLN LALT_T(KC_COLN)
#define MT_DOT LCTL_T(KC_DOT)
#define MT_COMM LSFT_T(KC_COMM)
// Layer keys
#define CS_LT3 LT(_UTILITY,KC_ENT)
#define CS_LT2 LT(_EDIT,MAGIC)
#define CS_LT1 LT(_DATA,KC_SPC)
#define CS_RT1 LT(_SYMBOL,KC_BSPC)
#define CS_RT2 LT(_PROGRAM,REP)
#define CS_RT3 LT(_UTILITY,KC_SLSH)
#define CS_AL1 LT(_DATA,KC_0)
#define CS_AL2 LT(_EDIT,CS_BSLS)
#define CS_AL3 LT(_EDIT,CS_SCLN)
#define CS_AL4 LT(_EDIT,KC_SPC)
// Custom tap-hold keys
#define CS_BOOT LT(0,KC_ESC)
#define TABLSFT LSFT_T(KC_TAB)
#define TABRSFT RSFT_T(KC_TAB)
// Control keys
#define CS_LCTL LM(_CONTROL, MOD_LCTL)
#define UNDO LCTL(KC_Z)
#define REDO LCTL(KC_Y)
#define CUT LCTL(KC_X)
#define COPY LCTL(KC_C)
#define PASTE LCTL(KC_V)
#define FIND LCTL(KC_F)
#define SAVE LCTL(KC_S)
#define ALL LCTL(KC_A)
#define CLOSE LCTL(KC_W)
#define TAB LCTL(KC_T)
#define WINDOW LCTL(KC_N)
#define REFRESH LCTL(KC_R)
#define MERGE LCTL(KC_E)
#define BOLD LCTL(KC_B)
#define GROUP LCTL(KC_G)
#define LEVEL LCTL(KC_L)
#define DUPL LCTL(KC_J)
// Other
#define NXT_TAB LCTL(KC_PGDN)
#define PRV_TAB LCTL(KC_PGUP)
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[_BASIC] = LAYOUT( //3
//,-----------------------------------------------------. ,-----------------------------------------------------.
KC_ESC, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, CS_HASH,
//|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
KC_LSFT, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_TAB,
//|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
KC_LCTL, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_QUOT, COM_DOT, QUE_EXL, NEWSENT,
//|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------|
CS_LT3, CS_LT2, KC_SPC, CS_RT1, CS_RT2, CS_RT3
//`--------------------------' `--------------------------'
),
[_QWERTY] = LAYOUT( //0
//,-----------------------------------------------------. ,-----------------------------------------------------.
KC_ESC, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, CS_HASH,
//|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
KC_LSFT, MT_A, MT_S, MT_D, MT_F, KC_G, KC_H, MT_J, MT_K, MT_L, MT_SCLN, TABRSFT,
//|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
CS_LCTL, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_QUOT, COM_DOT, QUE_EXL, NEWSENT,
//|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------|
CS_LT3, CS_LT2, CS_LT1, CS_RT1, CS_RT2, CS_RT3
//`--------------------------' `--------------------------'
),
[_BASE] = LAYOUT( //1
//,-----------------------------------------------------. ,-----------------------------------------------------.
KC_ESC, KC_Z, KC_L, KC_D, KC_C, KC_B, KC_J, KC_F, KC_O, KC_U, KC_SCLN, CS_HASH,
//|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
TABLSFT, MTA_N, MTA_R, MTA_T, MTA_S, KC_G, KC_Y, MTA_H, MTA_E, MTA_I, MTA_A, TABRSFT,
//|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
CS_LCTL, KC_Q, KC_X, KC_M, KC_W, KC_V, KC_K, KC_P, KC_QUOT, COM_DOT, QUE_EXL, NEWSENT,
//|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------|
CS_LT3, CS_LT2, CS_LT1, CS_RT1, CS_RT2, CS_RT3
//`--------------------------' `--------------------------'
),
[_CONTROL] = LAYOUT( //2
//,-----------------------------------------------------. ,-----------------------------------------------------.
_______, LEVEL, MERGE, CLOSE, REFRESH, TAB, _______, _______, _______, _______, _______, _______,
//|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
_______, DUPL, ALL, SAVE, FIND, WINDOW, _______, _______, _______, _______, _______, _______,
//|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
_______, REDO, UNDO, CUT, COPY, PASTE, _______, _______, _______, _______, _______, _______,
//|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------|
_______, _______, _______, _______, _______, _______
//`--------------------------' `--------------------------'
),
[_STENO] = LAYOUT( //4
//,-----------------------------------------------------. ,-----------------------------------------------------.
KC_ESC, STN_S1, STN_TL, STN_PL, STN_HL, STN_ST1, STN_ST3, STN_FR, STN_PR, STN_LR, STN_TR, STN_DR,
//|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
KC_LSFT, STN_S2, STN_KL, STN_WL, STN_RL, STN_ST2, STN_ST4, STN_RR, STN_BR, STN_GR, STN_SR, STN_ZR,
//|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
KC_LCTL, STN_N1, STN_N2, STN_N3, STN_N4, STN_N5, STN_N6, STN_N7, STN_N8, STN_N9, STN_NA, KC_ENT,
//|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------|
STN_FN, STN_A, STN_O, STN_E, STN_U, STN_PWR
//`--------------------------' `--------------------------'
),
[_DATA] = LAYOUT( //5
//,-----------------------------------------------------. ,-----------------------------------------------------.
_______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, CS_EQL, KC_7, KC_8, KC_9, CS_SCLN, KC_DEL,
//|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
_______, MT_PIPE, MT_COLN, MT_DOT, MT_COMM, CS_DLR, CS_LT, MT_1, MT_2, MT_3, MT_TILD, TABRSFT,
//|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
_______, CS_TILD, CS_CBRS, CS_PRNS, CS_BRCS, CS_POUN, CS_GT, KC_4, KC_5, KC_6, CS_QUES, KC_ENT,
//|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------|
_______, _______, _______, KC_BSPC, CS_AL1, CS_SLSH
//`--------------------------' `--------------------------'
),
[_SYMBOL] = LAYOUT( //6
//,-----------------------------------------------------. ,---------------------------------------------------.
KC_GRV, CS_PERC, CS_ASTR, CS_DLR, CS_AMPR, CS_CIRC, CS_EQL, KC_RCBR, KC_LCBR, CS_CIRC, CS_SCLN, KC_DEL,
//|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
_______, CS_PIPE, CS_LT, CS_MINS, CS_GT, CS_EQL, CS_LT, MT_RPRN, MT_LPRN, MT_UNDS, MT_TILD, TABRSFT,
//|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
_______, CS_TILD, CS_COLN, CS_DOT, CS_COMM, CS_UNDS, CS_GT, KC_RBRC, KC_LBRC, CS_EXLM, CS_QUES, KC_ENT,
//|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------|
CS_SLSH, CS_AL2, KC_SPC, _______, _______, _______
//`--------------------------' `--------------------------'
),
[_PROGRAM] = LAYOUT( //7
//,-----------------------------------------------------. ,-----------------------------------------------------.
KC_GRV, CS_PERC, CS_EXLM, CS_DQUO, CS_DLR, CS_AMPR, CS_EQL, KC_RCBR, KC_LCBR, CS_CIRC, CS_SCLN, KC_DEL,
//|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
_______, CS_CIRC, CS_PLUS, CS_MINS, CS_EQL, CS_PIPE, CS_LT, MT_RPRN, MT_LPRN, MT_UNDS, MT_TILD, TABRSFT,
//|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
_______, CS_TILD, CS_ASTR, CS_SLSH, CS_HASH, CS_COLN, CS_GT, KC_RBRC, KC_LBRC, CS_EXLM, CS_QUES, KC_ENT,
//|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------|
CS_UNDS, CS_AL3, CS_AL4, _______, _______, _______
//`--------------------------' `--------------------------'
),
[_EDIT] = LAYOUT( //8
//,-----------------------------------------------------. ,-----------------------------------------------------.
_______, KC_PAUS, CS_HOME, KC_UP, CS_END, QK_LLCK, CS_EQL, KC_RCBR, KC_LCBR, CS_CIRC, CS_SCLN, KC_DEL,
//|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
_______, KC_INS, KC_LEFT, KC_DOWN, KC_RGHT, KC_DEL, CS_LT, MT_RPRN, MT_LPRN, MT_UNDS, MT_TILD, TABRSFT,
//|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
_______, KC_PSCR, KC_PGUP, KC_PGDN, KC_CAPS, SELECT, CS_GT, KC_RBRC, KC_LBRC, CS_EXLM, CS_QUES, KC_ENT,
//|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------|
_______, _______, _______, _______, KC_0, KC_SPC
//`--------------------------' `--------------------------'
),
[_MOUSE] = LAYOUT( //9
//,-----------------------------------------------------. ,-----------------------------------------------------.
_______, NXT_TAB, MS_BTN4, MS_UP, MS_BTN5, QK_LLCK, _______, _______, _______, _______, _______, _______,
//|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
_______, PRV_TAB, MS_LEFT, MS_DOWN, MS_RGHT, KC_DEL, _______, _______, _______, _______, _______, _______,
//|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
_______, MS_WHLL, MS_WHLU, MS_WHLD, MS_WHLR, SELECT, _______, _______, _______, _______, _______, _______,
//|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------|
MS_BTN3, MS_BTN2, MS_BTN1, MS_ACL2, MS_ACL0, MS_ACL1
//`--------------------------' `--------------------------'
),
// [_MOUSE_BTN] = LAYOUT( //10
// //,-----------------------------------------------------. ,-----------------------------------------------------.
// _______, _______, KC_BTN4, _______, KC_BTN5, KC_TAB, _______, _______, _______, _______, _______, _______,
// //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
// _______, _______, _______, _______, _______, KC_DEL, _______, _______, _______, _______, _______, _______,
// //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
// _______, _______, _______, _______, _______, SELECT, _______, _______, _______, _______, _______, _______,
// //|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------|
// KC_BTN3, KC_BTN2, KC_BTN1, _______, _______, _______
// //`--------------------------' `--------------------------'
// ),
[_NUMPAD] = LAYOUT( //11
//,-----------------------------------------------------. ,-----------------------------------------------------.
_______, _______, _______, _______, _______, _______, KC_NUM, KC_P7, KC_P8, KC_P9, KC_CIRC, KC_DEL,
//|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
_______, _______, _______, _______, _______, _______, KC_PLUS, KC_P4, KC_P5, KC_P6, KC_ASTR, TABRSFT,
//|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
_______, _______, _______, _______, _______, _______, KC_MINS, KC_P1, KC_P2, KC_P3, KC_UNDS, KC_ENT,
//|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------|
_______, _______, _______, _______, KC_P0, _______
//`--------------------------' `--------------------------'
),
[_UTILITY] = LAYOUT( //12
//,-----------------------------------------------------. ,-----------------------------------------------------.
ALTTAB, CLOCKUP, CS_VALD, CS_VOLU, CS_VALU, OLEDSAV, CS_RGBN, KC_F7, KC_F8, KC_F9, KC_F10, CS_BOOT,
//|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
_______, CLOCKDN, KC_MPRV, CS_VOLD, KC_MNXT, BASE, BASIC, KC_F1, KC_F2, KC_F3, KC_F11, DB_TOGG,
//|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
_______, CLOCKNX, OLEDTOG, MUTE, KC_SCRL, MENU, CS_RGBT, KC_F4, KC_F5, KC_F6, KC_F12, KC_ENT,
//|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------|
KC_MSTP, MUTE_L, KC_MPLY, KC_MPLY, MUTE_R, KC_MSTP
//`--------------------------' `--------------------------'
),
[_TOUHOU] = LAYOUT( //13
//,-----------------------------------------------------. ,-----------------------------------------------------.
_______, _______, _______, KC_UP, _______, _______, _______, _______, _______, _______, _______, KC_DEL,
//|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
_______, _______, KC_LEFT, KC_DOWN, KC_RGHT, _______, _______, KC_Z, KC_X, _______, _______, KC_TAB,
//|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_ENT,
//|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------|
_______, _______, _______, _______, _______, _______
//`--------------------------' `--------------------------'
),
};
#include "features/achordion.h"
//==============================================================================
// Variables
//==============================================================================
uint8_t time_setting = 0;
uint8_t min = 0;
uint8_t hrs = 0;
uint8_t sec = 0;
// uint8_t t_min = 0;
// uint8_t t_hrs = 0;
// uint8_t t_sec = 0;
uint8_t menu = 0;
bool static_display = false;
bool left_active = false;
bool right_active = false;
bool muted = false;
uint16_t boot_timer;
bool boot = false;
uint8_t set_rgb_mode = 5;
bool ctrl_linger = false;
bool left_eager_shift_on = false;
bool right_eager_shift_on = false;
bool ctrl_on(void) {
return ((get_mods() & MOD_BIT(KC_LCTL)) == MOD_BIT(KC_LCTL) || (get_mods() & MOD_BIT(KC_RCTL)) == MOD_BIT(KC_RCTL));
}
bool shifted(void) {
return ((get_mods() & MOD_BIT(KC_LSFT)) == MOD_BIT(KC_LSFT) || (get_mods() & MOD_BIT(KC_RSFT)) == MOD_BIT(KC_RSFT));
}
bool is_alpha(uint16_t keycode) {
if (keycode >= KC_A && keycode <= KC_Z) {
return true;
} else {
return false;
}
}
bool is_hrm(uint16_t keycode) {
switch (keycode) {
case MT_A:
case MT_S:
case MT_D:
case MT_F:
case MT_J:
case MT_K:
case MT_L:
case MT_SCLN:
case MTA_N:
case MTA_R:
case MTA_T:
case MTA_S:
case MTA_H:
case MTA_E:
case MTA_I:
case MTA_A:
// case MT_TILD:
// case MT_UNDS:
// case MT_LPRN:
// case MT_RPRN:
// case MT_CIRC:
// case MT_PLUS:
// case MT_MINS:
// case MT_EQL:
// case MT_1:
// case MT_2:
// case MT_3:
// case MT_PIPE:
// case MT_COLN:
// case MT_DOT:
// case MT_COMM:
return true;
default:
return false;
}
}
bool magic_override = false;
uint8_t char_count = 1;
uint16_t last_key = KC_NO;
uint16_t last_key_2 = KC_NO;
uint16_t last_key_3 = KC_NO;
bool is_magic(uint16_t keycode) {
if ((keycode == CS_LT2) || (keycode == CS_RT2)) {
return true;
} else {
return false;
}
}
bool is_bspc(uint16_t keycode) {
if ((keycode == CS_RT1) || (keycode == KC_BSPC)) {
return true;
} else {
return false;
}
}
bool is_spc(uint16_t keycode) {
if ((keycode == CS_RT1) || (keycode == KC_SPC)) {
return true;
} else {
return false;
}
}
//==============================================================================
// Trackpoint
//==============================================================================
// static uint8_t trackpoint_sensitivity = 90;
// void trackpoint_set_sensitivity(uint8_t sensitivity) {
// PS2_MOUSE_SEND(0xE2, "trackpoint_set_sensitivity: 0xE2");
// PS2_MOUSE_SEND(0x81, "trackpoint_set_sensitivity: 0x81");
// PS2_MOUSE_SEND(0x4A, "trackpoint_set_sensitivity: 0x4A");
// PS2_MOUSE_SEND(sensitivity, "trackpoint_set_sensitivity: xxx");
// }
// void trackpoint_reset(void) {
// PS2_MOUSE_SEND(0xE2, "trackpoint_reset: 0xE2");
// PS2_MOUSE_SEND(0x51, "trackpoint_reset: 0x51");
// }
// void ps2_mouse_init_user() {
// // set TrackPoint sensitivity
// trackpoint_set_sensitivity(trackpoint_sensitivity);
// }
// void ps2_regdump(void) {
// println("Register dump:");
// print(" ");
// for (uint8_t addr = 0; addr <= 0xF; addr++) {
// print_hex8(addr);
// print(" ");
// }
// println("");
// for (uint16_t addr = 0; addr <= 0xFF; addr++) {
// uint8_t data;
// if ((addr & 0xf) == 0) {
// print_hex8(addr);
// print(" | ");
// }
// ps2_host_send(0xE2);
// ps2_host_send(0x80);
// data = ps2_host_send((uint8_t)addr);
// if (data == 0xFA) {
// data = ps2_host_recv_response();
// print_hex8(data);
// print(" ");
// } else {
// print("xx ");
// }
// if ((addr & 0xf) == 0xf) {
// println("");
// }
// }
// println("");
// }
// static uint16_t mh_auto_buttons_timer;
// extern int tp_buttons; // mousekey button state set in action.c and used in ps2_mouse.c
// void ps2_mouse_moved_user(report_mouse_t *mouse_report) {
// if (abs(mouse_report->x) <= 1 && abs(mouse_report->y) <= 1) {
// // Ignore tiny mouse events
// return;
// }
// if (mh_auto_buttons_timer) {
// mh_auto_buttons_timer = timer_read();
// } else {
// if (!tp_buttons) {
// layer_on(MH_AUTO_BUTTONS_LAYER);
// mh_auto_buttons_timer = timer_read();
// #if defined CONSOLE_ENABLE
// print("mh_auto_buttons: on\n");
// #endif
// }
// }
// }
//==============================================================================
// Timers
//==============================================================================
#define IDLE_TIMEOUT 1000 * 60 * 5
static bool alt_tab_active = false;
static bool oled_timeout = false;
static bool oled_disable = false;
void matrix_scan_user(void) {
achordion_task();
if (timer_elapsed(boot_timer) > 5000) {
boot = false;
}
// if (mh_auto_buttons_timer && (timer_elapsed(mh_auto_buttons_timer) > MH_AUTO_BUTTONS_TIMEOUT)) {
// if (!tp_buttons) {
// layer_off(MH_AUTO_BUTTONS_LAYER);
// mh_auto_buttons_timer = 0;
// }
// }
if (get_highest_layer(layer_state) == _NUMPAD) {
if (last_input_activity_elapsed() > IDLE_TIMEOUT) { // Layer timeout
layer_off(_NUMPAD);
layer_off(_TOUHOU);
}
}
if (alt_tab_active) {
if (IS_LAYER_OFF(_UTILITY)) {
unregister_code(KC_LALT);
alt_tab_active = false;
}
}
if (last_input_activity_elapsed() > 500) { // Reset delete tracking
char_count = 1;
}
if (last_input_activity_elapsed() > 1000) { // Reset magic keys
last_key = KC_NO;
last_key_2 = KC_NO;
last_key_3 = KC_NO;
}
if (last_input_activity_elapsed() > 15000) { // OLED timeout
time_setting = 0;
oled_timeout = true;
} else {
oled_timeout = false;
}
}
//==============================================================================
// Tap/hold
//==============================================================================
uint16_t get_quick_tap_term(uint16_t keycode, keyrecord_t *record) {
if (is_hrm(keycode)) {
return 0;
}
switch (keycode) {
case CS_LT3:
case CS_LT2:
case CS_LT1:
case CS_RT1:
case CS_RT2:
case CS_RT3:
case CS_AL1:
case CS_AL2:
case CS_AL3:
case CS_AL4:
case MT_RPRN:
case MT_LPRN:
case MT_UNDS:
case MT_TILD:
case MT_CIRC:
case MT_PLUS:
case MT_MINS:
case MT_EQL:
case TABLSFT:
case TABRSFT:
return 0;
default:
return TAPPING_TERM;
}
}
uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case CS_LT3:
case CS_LT2:
case CS_LT1:
case CS_RT1:
case CS_RT2:
case CS_RT3:
// Shift mod-taps
case MT_D:
case MT_K:
case MTA_T:
case MTA_E:
return 150;
// Alt mod-taps
case MT_S:
case MT_L:
case MTA_R:
case MTA_I:
return 225;
// GUI mod-taps
case MT_A:
case MT_SCLN:
case MTA_N:
case MTA_A:
return 250;
default:
return TAPPING_TERM;
}
}
bool get_hold_on_other_key_press(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case CS_LT3:
case CS_LT2:
// case CS_LT1:
case CS_RT1:
// case CS_RT2:
case CS_RT3:
// case CS_AL1:
// case CS_AL2:
// case CS_AL3:
// case CS_AL4:
case TABLSFT:
case TABRSFT:
// Immediately select the hold action when another key is pressed.
return true;
default:
// Do not select the hold action when another key is pressed.
return false;
}
}
bool get_permissive_hold(uint16_t keycode, keyrecord_t *record) {
return true;
}
uint16_t achordion_timeout(uint16_t tap_hold_keycode) {
switch (tap_hold_keycode) {
case CS_LT3:
// case CS_LT2:
case CS_LT1:
case CS_RT1:
// case CS_RT2:
case CS_RT3:
// case CS_AL1:
case CS_AL2:
case CS_AL3:
case CS_AL4:
case CS_BOOT:
case TABLSFT:
case TABRSFT:
return 0;
default:
return 300;
}
}
bool achordion_chord(uint16_t tap_hold_keycode, keyrecord_t* tap_hold_record,
uint16_t other_keycode, keyrecord_t* other_record) {
if (is_hrm(tap_hold_keycode)) {
return achordion_opposite_hands(tap_hold_record, other_record);
}
switch (tap_hold_keycode) {
case CS_AL1:
case CS_RT2:
return achordion_opposite_hands(tap_hold_record, other_record);
case CS_LT2:
default:
return true;
}
}
uint16_t achordion_streak_chord_timeout( uint16_t tap_hold_keycode, uint16_t next_keycode) {
uint8_t mod = mod_config(QK_MOD_TAP_GET_MODS(tap_hold_keycode));
if ((next_keycode == CS_LCTL) || (next_keycode == KC_LCTL) || (next_keycode == KC_LSFT) || (next_keycode == TABLSFT) || (next_keycode == TABRSFT)) {
return 0;
}
if (is_magic(tap_hold_keycode)) {
return 75;
}
if (((mod & MOD_LSFT) != 0) || ((mod & MOD_RSFT) != 0)) {
return 100;
}
return 250;
}
bool achordion_eager_mod(uint8_t mod) {
switch (mod) {
case MOD_LSFT:
case MOD_RSFT:
case MOD_LCTL:
case MOD_RCTL:
// case MOD_LALT:
// case MOD_RALT:
return true;
default:
return false;
}
}
bool process_cs_layer_tap(uint16_t keycode, keyrecord_t* record) {
if (keycode == CS_AL1) {
if (!record->tap.count && record->event.pressed) {
layer_on(_EDIT);
} else {
layer_off(_EDIT);
}
if (record->tap.count && record->event.pressed) {
const uint8_t mods = get_mods();
del_mods(MOD_MASK_SHIFT);
tap_code(KC_0);
set_mods(mods);
}
return false;
}
if (keycode == CS_AL2) {
if (!record->tap.count && record->event.pressed) {
layer_on(_EDIT);
} else {
layer_off(_EDIT);
}
if (record->tap.count && record->event.pressed) {
const uint8_t mods = get_mods();
del_mods(MOD_MASK_SHIFT);
tap_code16(KC_NUBS);
set_mods(mods);
}
return false;
}
if (keycode == CS_AL3) {
if (!record->tap.count && record->event.pressed) {
layer_on(_EDIT);
} else {
layer_off(_EDIT);
}
if (record->tap.count && record->event.pressed) {
const uint8_t mods = get_mods();
del_mods(MOD_MASK_SHIFT);
tap_code(KC_SCLN);
set_mods(mods);
}
return false;
}
return true;
}
//==============================================================================
// Combos
//==============================================================================
enum combo_events {
TOUHOU,
STENO,
MOUSE,
MOUSE2,
NUMPAD,
L_EXPONENT,
L_COMMA,
L_DOT,
L_UNDERSCORE,
L_ASTERISK,
L_PLUS,
L_EQUALS,
L_MINUS,
EXCLAMATION,
COLON,
R_EXPONENT,
R_COMMA,
R_DOT,
R_UNDERSCORE,
R_ASTERISK,
R_PLUS,
R_EQUALS,
R_MINUS,
SEMICOLON,
AMPERSAND,
SPC_1,
SPC_2,
SPC_3,
BSPC_1,
BSPC_2,
BSPC_3,
L_NEW,
R_NEW,
BACKSPACE,
COMBO_LENGTH
};
uint16_t COMBO_LEN = COMBO_LENGTH;
const uint16_t PROGMEM touhou[] = {KC_P, CS_HASH, KC_ESC, COMBO_END};
const uint16_t PROGMEM steno[] = {KC_P, CS_HASH, KC_SCLN, KC_TAB, COMBO_END};
const uint16_t PROGMEM numpad[] = {KC_O, KC_P, CS_HASH, COMBO_END};
const uint16_t PROGMEM mouse[] = {KC_SCLN, QUE_EXL, COMBO_END};
const uint16_t PROGMEM mouse2[] = {KC_A, KC_Z, COMBO_END};
const uint16_t PROGMEM l_exponent[] = {KC_W, KC_E, COMBO_END};
const uint16_t PROGMEM l_comma[] = {KC_D, KC_V, COMBO_END};
const uint16_t PROGMEM l_dot[] = {KC_S, KC_D, COMBO_END};
const uint16_t PROGMEM l_underscore[] = {KC_C, KC_V, COMBO_END};
const uint16_t PROGMEM l_asterisk[] = {KC_F, KC_B, COMBO_END};
const uint16_t PROGMEM l_equals[] = {KC_E, KC_R, COMBO_END};
const uint16_t PROGMEM l_plus[] = {KC_F, KC_G, COMBO_END};
const uint16_t PROGMEM l_minus[] = {KC_D, KC_F, COMBO_END};
const uint16_t PROGMEM ampersand[] = {KC_S, KC_E, COMBO_END};
const uint16_t PROGMEM colon[] = {KC_E, KC_F, COMBO_END};
const uint16_t PROGMEM r_exponent[] = {KC_I, KC_O, COMBO_END};
const uint16_t PROGMEM r_comma[] = {KC_M, KC_K, COMBO_END};
const uint16_t PROGMEM r_dot[] = {KC_K, KC_L, COMBO_END};
const uint16_t PROGMEM r_underscore[] = {KC_M, KC_QUOT, COMBO_END};
const uint16_t PROGMEM r_asterisk[] = {KC_N, KC_J, COMBO_END};
const uint16_t PROGMEM r_equals[] = {KC_U, KC_I, COMBO_END};
const uint16_t PROGMEM r_plus[] = {KC_H, KC_J, COMBO_END};
const uint16_t PROGMEM r_minus[] = {KC_J, KC_K, COMBO_END};
const uint16_t PROGMEM semicolon[] = {KC_J, KC_I, COMBO_END};
const uint16_t PROGMEM exclamation[] = {KC_I, KC_L, COMBO_END};
const uint16_t PROGMEM spc_3[] = {KC_SPC, KC_S, COMBO_END};
const uint16_t PROGMEM spc_2[] = {KC_SPC, KC_D, COMBO_END};
const uint16_t PROGMEM spc_1[] = {KC_SPC, KC_F, COMBO_END};
const uint16_t PROGMEM bspc_1[] = {CS_RT1, KC_J, COMBO_END};
const uint16_t PROGMEM bspc_2[] = {CS_RT1, KC_K, COMBO_END};
const uint16_t PROGMEM bspc_3[] = {CS_RT1, KC_L, COMBO_END};
const uint16_t PROGMEM l_new[] = {KC_X, KC_C, COMBO_END};
const uint16_t PROGMEM r_new[] = {KC_QUOT, COM_DOT, COMBO_END};
const uint16_t PROGMEM backspace[] = {KC_SPC, CS_RT1, COMBO_END};
// const uint16_t PROGMEM num_1[] = {KC_Q, KC_A, COMBO_END};
// const uint16_t PROGMEM num_2[] = {KC_W, KC_S, COMBO_END};
// const uint16_t PROGMEM num_3[] = {KC_E, KC_D, COMBO_END};
// const uint16_t PROGMEM num_4[] = {KC_R, KC_F, COMBO_END};
// const uint16_t PROGMEM num_5[] = {KC_T, KC_G, COMBO_END};
combo_t key_combos[] = {
[TOUHOU] = COMBO_ACTION(touhou),
[STENO] = COMBO_ACTION(steno),
[NUMPAD] = COMBO_ACTION(numpad),
[MOUSE] = COMBO(mouse, CM_MOUSE),
[MOUSE2] = COMBO(mouse2, CM_MOUSE),
[SPC_3] = COMBO(spc_3, MS_BTN4),
[SPC_2] = COMBO(spc_2, DELWORD),
[SPC_1] = COMBO(spc_1, MS_BTN5),
[BSPC_1] = COMBO(bspc_1, SPC_UP),
[BSPC_2] = COMBO(bspc_2, JOIN),
[BSPC_3] = COMBO(bspc_3, SPC_DN),
[L_EXPONENT] = COMBO(l_exponent, CS_CIRC),
[L_COMMA] = COMBO(l_comma, CS_COMM),
[L_DOT] = COMBO(l_dot, CS_DOT),
[L_UNDERSCORE] = COMBO(l_underscore, CS_UNDS),
[L_ASTERISK] = COMBO(l_asterisk, CS_ASTR),
[L_EQUALS] = COMBO(l_equals, CS_EQL),
[L_PLUS] = COMBO(l_plus, CS_PLUS),
[L_MINUS] = COMBO(l_minus, CS_MINS),
[AMPERSAND] = COMBO(ampersand, CS_AMPR),
[COLON] = COMBO(colon, CS_COLN),
[R_EXPONENT] = COMBO(r_exponent, CS_CIRC),
[R_COMMA] = COMBO(r_comma, CS_COMM),
[R_DOT] = COMBO(r_dot, CS_DOT),
[R_UNDERSCORE] = COMBO(r_underscore, CS_UNDS),
[R_ASTERISK] = COMBO(r_asterisk, CS_ASTR),
[R_EQUALS] = COMBO(r_equals, CS_EQL),
[R_PLUS] = COMBO(r_plus, CS_PLUS),
[R_MINUS] = COMBO(r_minus, CS_MINS),
[SEMICOLON] = COMBO(semicolon, CS_SCLN),
[EXCLAMATION] = COMBO(exclamation, CS_EXLM),
[L_NEW] = COMBO(r_new, NEWSENT),
[R_NEW] = COMBO(l_new, NEWSENT),
[BACKSPACE] = COMBO(backspace, CTLBSPC),
};
void process_combo_event(uint16_t combo_index, bool pressed) {
switch(combo_index) {
case TOUHOU:
if (pressed) {
menu = 1;
if (IS_LAYER_ON(_TOUHOU)) {