1 #include QMK_KEYBOARD_H
3 extern keymap_config_t keymap_config;
6 //Following line allows macro to read current RGB settings
7 extern rgblight_config_t rgblight_config;
8 rgblight_config_t RGB_current_config;
11 extern uint8_t is_master;
13 // Each layer gets a name for readability, which is then used in the keymap matrix below.
14 // The underscores don't mean anything - you can have a layer called STUFF or any other name.
15 // Layer names don't all need to be of the same length, obviously, and you can also skip them
16 // entirely and just use numbers.
24 enum custom_keycodes {
43 #define M_SAMPLE M(KC_SAMPLEMACRO)
45 const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { \
47 * ,-----------------------------------------. ,-----------------------------------------.
48 * | Tab | Q | W | E | R | T | | Y | U | I | O | P | Bksp |
49 * |------+------+------+------+------+------| |------+------+------+------+------+------|
50 * | Ctrl | A | S | D | F | G | | H | J | K | L | ; | ' |
51 * |------+------+------+------+------+------| |------+------+------+------+------+------|
52 * | Shift| Z | X | C | V | B | | N | M | , | . | / |Enter |
53 * |------+------+------+------+------+------| |------+------+------+------+------+------|
54 * | Esc |ADJUST| Alt | GUI |LOWER |Space | | Space| RAISE| KANA | Left | Down | Right|
55 * `-----------------------------------------' `-----------------------------------------'
57 [_QWERTY] = LAYOUT_ortho_4x12(
58 KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC, \
59 KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, \
60 KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT , \
61 KC_ESC, ADJUST, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KANA, KC_LEFT, KC_DOWN, KC_RGHT \
65 * ,-----------------------------------------. ,-----------------------------------------.
66 * | ~ | ! | @ | # | $ | % | | ^ | & | * | ( | ) | |
67 * |------+------+------+------+------+------| |------+------+------+------+------+------|
68 * | | | | | | | | - | _ | + | { | } | | |
69 * |------+------+------+------+------+------| |------+------+------+------+------+------|
70 * | | | | | | | | | | | | UP | |
71 * |------+------+------+------+------+------| |------+------+------+------+------+------|
72 * | | | | | | | | | | | | | |
73 * `-----------------------------------------' `-----------------------------------------'
75 [_LOWER] = LAYOUT_ortho_4x12( \
76 KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, _______, \
77 _______, _______, _______, _______, _______, _______, KC_MINS, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE, \
78 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_UP, _______, \
79 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ \
83 * ,-----------------------------------------. ,-----------------------------------------.
84 * | ` | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 | Del |
85 * |------+------+------+------+------+------| |------+------+------+------+------+------|
86 * | | F1 | F2 | F3 | F4 | F5 | | F6 | - | = | [ | ] | \ |
87 * |------+------+------+------+------+------| |------+------+------+------+------+------|
88 * | | F7 | F8 | F9 | F10 | F11 | | F12 | | | | ? | |
89 * |------+------+------+------+------+------| |------+------+------+------+------+------|
90 * | | | | | | | | | | Next | Vol- | Vol+ | Play |
91 * `-----------------------------------------' `-----------------------------------------'
93 [_RAISE] = LAYOUT_ortho_4x12( \
94 KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_DEL, \
95 _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS, \
96 _______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, _______, _______, S(KC_SLSH), _______, \
97 _______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY \
100 /* Adjust (Lower + Raise)
101 * ,-----------------------------------------. ,-----------------------------------------.
102 * | | Reset|RGBRST| | | | | | | | | | Ins |
103 * |------+------+------+------+------+------| |------+------+------+------+------+------|
104 * | |RGB ON| HUE+ | SAT+ | VAL+ | Mac | | Win | - | = |Print |ScLock|Pause |
105 * |------+------+------+------+------+------| |------+------+------+------+------+------|
106 * | | MODE | HUE- | SAT- | VAL- | | | | | | |PageUp| |
107 * |------+------+------+------+------+------| |------+------+------+------+------+------|
108 * | | | | EISU | EISU | EISU | | KANA | KANA | KANA | Home |PageDn| End |
109 * `-----------------------------------------' `-----------------------------------------'
111 [_ADJUST] = LAYOUT_ortho_4x12( \
112 _______, RESET, RGBRST, _______, _______, _______, _______, _______, _______, _______, _______, KC_INS, \
113 _______, RGB_TOG, RGB_HUI, RGB_SAI, RGB_VAI, AG_NORM, AG_SWAP, KC_MINS, KC_EQL, KC_PSCR, KC_SLCK, KC_PAUS,\
114 _______, RGB_MOD, RGB_HUD, RGB_SAD, RGB_VAD, _______, _______, _______, _______, _______, KC_PGUP, _______,\
115 _______, _______, _______, EISU, EISU, EISU, KANA, KANA, KANA, KC_HOME, KC_PGDN, KC_END\
119 // define variables for reactive RGB
120 bool TOG_STATUS = false;
122 // Setting ADJUST layer RGB back to default
123 void update_tri_layer_RGB(uint8_t layer1, uint8_t layer2, uint8_t layer3) {
124 if (IS_LAYER_ON(layer1) && IS_LAYER_ON(layer2)) {
125 #ifdef RGBLIGHT_ENABLE
126 rgblight_mode_noeeprom(RGB_current_config.mode);
134 bool process_record_user(uint16_t keycode, keyrecord_t *record) {
137 if (record->event.pressed) {
138 set_single_persistent_default_layer(_QWERTY);
144 if (record->event.pressed) {
145 //not sure how to have keyboard check mode and set it to a variable, so my work around
146 //uses another variable that would be set to true after the first time a reactive key is pressed.
147 if (TOG_STATUS) { //TOG_STATUS checks is another reactive key currently pressed, only changes RGB mode if returns false
149 TOG_STATUS = !TOG_STATUS;
150 #ifdef RGBLIGHT_ENABLE
151 rgblight_mode_noeeprom(16);
155 update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST);
157 #ifdef RGBLIGHT_ENABLE
158 rgblight_mode_noeeprom(RGB_current_config.mode); // revert RGB to initial mode prior to RGB mode change
162 update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST);
168 if (record->event.pressed) {
169 //not sure how to have keyboard check mode and set it to a variable, so my work around
170 //uses another variable that would be set to true after the first time a reactive key is pressed.
171 if (TOG_STATUS) { //TOG_STATUS checks is another reactive key currently pressed, only changes RGB mode if returns false
173 TOG_STATUS = !TOG_STATUS;
174 #ifdef RGBLIGHT_ENABLE
175 rgblight_mode_noeeprom(15);
179 update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST);
181 #ifdef RGBLIGHT_ENABLE
182 rgblight_mode_noeeprom(RGB_current_config.mode); // revert RGB to initial mode prior to RGB mode change
186 update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST);
192 if (record->event.pressed) {
199 //led operations - RGB mode change now updates the RGB_current_mode to allow the right RGB mode to be set after reactive keys are released
201 #ifdef RGBLIGHT_ENABLE
202 if (record->event.pressed) {
203 rgblight_mode_noeeprom(RGB_current_config.mode);
205 RGB_current_config.mode = rgblight_config.mode;
212 if (record->event.pressed) {
213 if(keymap_config.swap_lalt_lgui==false){
214 register_code(KC_LANG2);
216 SEND_STRING(SS_LALT("`"));
219 unregister_code(KC_LANG2);
224 if (record->event.pressed) {
225 if(keymap_config.swap_lalt_lgui==false){
226 register_code(KC_LANG1);
228 SEND_STRING(SS_LALT("`"));
231 unregister_code(KC_LANG1);
237 #ifdef RGBLIGHT_ENABLE
238 if (record->event.pressed) {
239 eeconfig_update_rgblight_default();
241 RGB_current_config = rgblight_config;
250 void matrix_init_user(void) {
251 #ifdef RGBLIGHT_ENABLE
253 RGB_current_config = rgblight_config;