-
Notifications
You must be signed in to change notification settings - Fork 0
/
keymap.c
199 lines (167 loc) · 9.84 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
/*
Copyright 2019 @foostan
Copyright 2020 Drashna Jaelre <@drashna>
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 <stdio.h>
#include "layers.h"
#ifdef OLED_ENABLE
#include "oled.h"
#endif
#ifdef RGBLIGHT_ENABLE
#include "rgb.h"
#endif
// Base Layers
#define COLEMAK DF(_COLEMAK)
#define TO_DFLT TO(0)
#define TO_UTIL TO(_UTIL)
#define TO_NAV TO(_NAV)
// Other Layers
#define T_SYM TT(_SYM)
#define S_SYM MO(_SYM)
#define T_NUM TT(_NUM)
#define S_NUM MO(_NUM)
#define T_LNUM TT(_LNUM)
#define S_LNUM MO(_LNUM)
#define S_NAV MO(_NAV)
#define T_NAV TT(_NAV)
#define S_UTIL MO(_UTIL)
#define T_UTIL TT(_UTIL)
#define TAB_FWD LCTL(KC_TAB)
#define TAB_BCK LCTL(LSFT(KC_TAB))
#define TAB_CLS LGUI(KC_W)
#define NAV_FWD LGUI(KC_RBRC)
#define NAV_BCK LGUI(KC_LBRC)
#define OSM_LSFT OSM(MOD_LSFT)
#define OSM_RSFT OSM(MOD_RSFT)
#define QK_FLSH LSFT(QK_MAKE)
// #define MT_S MT(MOD_LALT, KC_S)
// #define MT_T MT(MOD_LGUI, KC_T)
// #define MT_N MT(MOD_RGUI, KC_N)
// #define MT_E MT(MOD_RALT, KC_E)
#define MT_A MT(MOD_LSFT, KC_A)
#define MT_R MT(MOD_LCTL, KC_R)
#define MT_S MT(MOD_LALT, KC_S)
#define MT_T MT(MOD_LGUI, KC_T)
#define MT_N MT(MOD_RGUI, KC_N)
#define MT_E MT(MOD_RALT, KC_E)
#define MT_I MT(MOD_LCTL, KC_I)
#define MT_O MT(MOD_LSFT, KC_O)
#define MT_EQL MT(MOD_MEH, KC_EQL)
#define MT_GRV MT(MOD_MEH, KC_GRV)
#define MT_SPC MT(MOD_RCTL, KC_SPACE)
#define KC_CPY LGUI(KC_C)
#define KC_CUT LGUI(KC_X)
#define KC_UNDO LGUI(KC_Z)
#define KC_PST LGUI(KC_V)
#define KC_SEL LGUI(KC_A)
#define KC_EUR ALGR(KC_5)
#define XT(i) LCTL(i)
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[_COLEMAK] = LAYOUT_split_3x6_3(
//,-----------------------------------------------------. ,-----------------------------------------------------.
KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_B, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_QUOT,
//|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
KC_ESC, MT_A, MT_R, MT_S, MT_T, KC_G, KC_M, MT_N, MT_E, MT_I, MT_O, KC_ENT,
//|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
MT_EQL, KC_Z, KC_X, KC_C, KC_D, KC_V, KC_K, KC_H, KC_COMM, KC_DOT, KC_SLSH, MT_GRV,
//|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------|
OSM_LSFT, T_NUM, MT_SPC, KC_BSPC, T_SYM, OSM_RSFT
//`--------------------------' `--------------------------'
),
[_SYM] = LAYOUT_split_3x6_3(
//,-----------------------------------------------------. ,-----------------------------------------------------.
_______, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_UNDS, KC_COLN, KC_DQUO,
//|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
_______, KC_LT, KC_LCBR, KC_LBRC, KC_LPRN, KC_PIPE, KC_BSLS, KC_RPRN, KC_RBRC, KC_RCBR, KC_GT, _______,
//|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
KC_EQL, KC_TILD, KC_PLUS, KC_MINS, KC_0, KC_LEFT, KC_RGHT, KC_1, KC_COMM, KC_DOT, KC_SLSH, KC_GRV,
//|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------|
KC_LSFT, _______, _______, _______, S_SYM, _______
//`--------------------------' `--------------------------'
),
[_NUM] = LAYOUT_split_3x6_3(
//,-----------------------------------------------------. ,-----------------------------------------------------.
KC_TAB, KC_EUR, KC_HOME, KC_UP, KC_END, KC_PGUP, KC_ASTR, KC_P7, KC_P8, KC_P9, KC_PLUS, KC_R,
//|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
_______, KC_SEL, KC_LEFT, KC_DOWN, KC_RGHT, KC_PGDN, KC_EQL, KC_P4, KC_P5, KC_P6, KC_MINS, _______,
//|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
KC_EQL, KC_UNDO, KC_CUT, KC_CPY, KC_DOT, KC_PST, KC_P0, KC_P1, KC_P2, KC_P3, KC_SLSH, KC_DEL,
//|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------|
T_LNUM, S_NUM, _______, _______, _______, KC_RSFT
//`--------------------------' `--------------------------'
),
[_LNUM] = LAYOUT_split_3x6_3(
//,-----------------------------------------------------. ,-----------------------------------------------------.
KC_TAB, KC_PLUS, KC_9, KC_8, KC_7, KC_ASTR, KC_R, KC_P7, KC_P8, KC_P9, KC_PLUS, KC_ASTR,
//|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
_______, KC_MINS, KC_6, KC_5, KC_4, KC_DOT, KC_EQL, KC_P4, KC_P5, KC_P6, KC_MINS, _______,
//|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
KC_EQL, KC_SLSH, KC_3, KC_2, KC_1, KC_0, KC_P0, KC_P1, KC_P2, KC_P3, KC_SLSH, KC_DEL,
//|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------|
KC_BSPC, S_LNUM, _______, _______, _______, KC_RSFT
//`--------------------------' `--------------------------'
),
[_NAV] = LAYOUT_split_3x6_3(
//,-----------------------------------------------------. ,-----------------------------------------------------.
KC_TAB, KC_CAPS, KC_WH_L, KC_MS_U, KC_WH_R, KC_WH_U, NAV_BCK, TAB_BCK, TAB_FWD, NAV_FWD, TAB_CLS, TO_NAV,
//|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
_______, KC_LGUI, KC_MS_L, KC_MS_D, KC_MS_R, KC_WH_D, LGUI(KC_BTN1), KC_BTN1, KC_BTN2, KC_BTN3, KC_RALT, _______,
//|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
_______, KC_UNDO, KC_CUT, KC_CPY, _______, KC_PST, TO_UTIL, KC_ACL0, KC_ACL1, KC_ACL2, XXXXXXX, _______,
//|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------|
KC_LSFT, _______, _______, _______, _______, KC_RSFT
//`--------------------------' `--------------------------'
),
[_UTIL] = LAYOUT_split_3x6_3(
//,-----------------------------------------------------. ,-----------------------------------------------------.
XXXXXXX, KC_BRMU, KC_MPRV, KC_VOLU, KC_MNXT, XXXXXXX, TO_DFLT, QK_MAKE, QK_FLSH, XXXXXXX, XXXXXXX, TO_DFLT,
//|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
_______, KC_BRMD, KC_MPLY, KC_VOLD, KC_MSTP, COLEMAK, TO_DFLT, RGB_MOD, RGB_HUI, RGB_SAI, RGB_VAI, _______,
//|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
EE_CLR, XXXXXXX, XXXXXXX, KC_MUTE, XXXXXXX, XXXXXXX, TO_DFLT, RGB_TOG, RGB_HUD, RGB_SAD, RGB_VAD, XXXXXXX,
//|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------|
_______, _______, _______, _______, _______, _______
//`--------------------------' `--------------------------'
)
};
layer_state_t layer_state_set_user(layer_state_t state) {
switch (get_highest_layer(default_layer_state)) {
case _COLEMAK:
state = update_tri_layer_state(state, _SYM, _NUM, _NAV);
break;
}
#ifdef RGBLIGHT_ENABLE
rgb_set_layer_state(state);
#endif
return state;
}
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
#ifdef OLED_ENABLE
oled_process_record(keycode, record);
#endif
return true;
}
void keyboard_post_init_user(void) {
#ifdef RGBLIGHT_ENABLE
rgb_keyboard_post_init();
#endif
}
void suspend_power_down_kb(void)
{
rgb_matrix_set_suspend_state(true);
}
void suspend_wakeup_init_kb(void)
{
rgb_matrix_set_suspend_state(false);
}