keymap.c (9764B)
1 /* Copyright 2022 Alexander (Sasha) Karmanov 2 * 3 * This program is free software: you can redistribute it and/or modify 4 * it under the terms of the GNU General Public License as published by 5 * the Free Software Foundation, either version 2 of the License, or 6 * (at your option) any later version. 7 * 8 * This program is distributed in the hope that it will be useful, 9 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 * GNU General Public License for more details. 12 * 13 * You should have received a copy of the GNU General Public License 14 * along with this program. If not, see <http://www.gnu.org/licenses/>. 15 */ 16 #include QMK_KEYBOARD_H 17 18 // Defines names for use in layer keycodes and the keymap 19 enum layer_names { 20 _QWERTY, 21 _CURSORLEFT, 22 _CURSORRGHT, 23 _NUMBERS, 24 _EXTRARIGHT 25 }; 26 27 const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { 28 29 /* Qwerty 30 * ,-----------------------------------------+ +-----------------------------------------. 31 * | Esc | Q | W | E | R | T | | Y | U | I | O | P |BSpc | 32 * |------+------+------+------+------+------+ +------+------+------+------+------+------| 33 * | Tab | A | S | D | F | G | | H | J | K | L | ; |Enter | 34 Hold: 35 Extra-Rt 36 * |------+------+------+------+------+------| |------+------+------+------+------+------| 37 * | Ctrl | Z | X | C | V | B | | N | M | , | . | / |RCtrl | 38 * +------+------+------+------+------+------+ +------+------+------+------+------+------+ 39 . | GUI | Alt | | | | | | RAlt | Menu | . 40 | +------+------+ | | | | +------+------+ | 41 Hold: | | LSft |CursLt| |CursRt| RSft | | 42 Single hit: | | |Space | |Space | | | 43 | +------+------| |------+------+ | 44 +------------------------------> SPACE SPACE <-----------------------------+ 45 46 */ 47 [_QWERTY] = LAYOUT( 48 KC_ESC, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC, 49 LT(_EXTRARIGHT,KC_TAB), KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_PENT, 50 KC_LCTL, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RCTL, 51 KC_SPC, KC_LGUI, KC_LALT, KC_LSFT, LT(_CURSORLEFT,KC_SPC), LT(_CURSORRGHT ,KC_SPC), KC_RSFT, KC_RALT, KC_APP, KC_SPC 52 ), 53 54 55 /* 56 57 Layers below are used on top of QWERTY layer defined above. 58 (Except the PLOVER/STENO layers.) 59 +-------+ 60 The keys which are shown empty, like this: | |, represent a transparent key, 61 +-------+ 62 meaning the key from the underlaying layer (i.e. QWERTY) will be used. 63 In the keymaps those keys are defined as "_______". 64 65 +-------+ +-------+ 66 The keys which are shown solid, like this: | XXXXX | or this | ... |, represent an opaque/blocking key? 67 +-------+ +-------+ 68 Such key is not doing anything in that layer nor allowing the key from the underlaying layer 69 to be invoked. 70 In the keymaps those keys are defined as "XXXXXXX". 71 72 Most of the modifiers are the same in all layers. 73 So in most layers they are defined as transparent keys, 74 letting the keys from QWERTY layer to do the work. 75 76 With that idea all the layers below leave the unmodified keys as transparent keys. 77 In the same time - the layers block the keys that have no sense to be used 78 in that given layer. For instance in the cursor control layers 79 some of the keys are not used in the layer, but they are blocked to avoid 80 alpha-keys from QWERTY layer to appear. 81 82 For the same reason the keymaps below are shown simplified, 83 without separate thumbcluster. 84 85 */ 86 87 88 89 /* Cursor Control on the right (Right Space) 90 * ,-----------------------------------------------------------------------------------. 91 * | Esc |Break |WheelD|MousUp|WheelU| Del | Ins | Home | Up | End | ` | Del | 92 * |------+------+------+------+------+-------------+------+------+------+------+------| 93 * | |SelAll|MousLt|MousDn|MousRt| ... | PgUp | Left | Down |Right | ... | | 94 * |------+------+------+------+------+------|------+------+------+------+------+------| 95 * | | Undo | Cut | Copy | Paste| ... | PgDn |MsBtLe|MsBtMi|MsBtRt| ... | | 96 * `------+------+------+------+------+------+------+------+------+------+------+------. 97 * | | | | | X | | | | 98 * `-------------------------------------------------------' 99 */ 100 [_CURSORRGHT] = LAYOUT( 101 _______, KC_BRK, MS_WHLD, MS_UP, MS_WHLU, KC_DEL, KC_PGUP, KC_HOME, KC_UP, KC_END, KC_GRV, KC_DEL, 102 KC_ENT, LCTL(KC_A), MS_LEFT, MS_DOWN, MS_RGHT, XXXXXXX, KC_PGDN, KC_LEFT, KC_DOWN, KC_RGHT, XXXXXXX, _______, 103 _______, LCTL(KC_Z), LSFT(KC_DEL), LCTL(KC_INS), LSFT(KC_INS), XXXXXXX, KC_INS, MS_BTN1, MS_BTN3, MS_BTN2, XXXXXXX, _______, 104 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ 105 ), 106 107 108 109 /* Cursor Control on the left (Left Space) 110 * ,-----------------------------------------------------------------------------------. 111 * | |Break | Home | Up | End | Ins | Del |WheelU|MousUp|WheelD| ` | Del | 112 * |------+------+------+------+------+------+-------------+------+------+------+------| 113 * | Enter|SelAll|Right | Down | Left | PgUp | xxx |MousLt|MousDn|MousRt| xxx |Enter | 114 * |------+------+------+------+------+------+------|------+------+------+------+------| 115 * | | xxx |MsBtRt|MsBtMi|MsBtLe| PgDn | xxx | Cut | Copy | Paste| xxx | | 116 * `------+------+------+------+------+------+------+------+------+------+------+------. 117 * | | | | X | | | | | 118 * `-------------------------------------------------------' 119 */ 120 [_CURSORLEFT] = LAYOUT( 121 _______, KC_BRK, KC_HOME, KC_UP, KC_END, KC_PGUP, KC_DEL, MS_WHLU, MS_UP, MS_WHLD, KC_GRV, KC_DEL, 122 KC_ENT, LCTL(KC_A), KC_LEFT, KC_DOWN, KC_RGHT, KC_PGDN, XXXXXXX, MS_LEFT, MS_DOWN, MS_RGHT, XXXXXXX, _______, 123 _______, XXXXXXX, MS_BTN2, MS_BTN3, MS_BTN1, KC_INS, XXXXXXX, LCTL(KC_DEL), LCTL(KC_INS), LSFT(KC_INS), XXXXXXX, _______, 124 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ 125 ), 126 127 128 /* Numbers on the home row, FNs on the top row, symbols in the second row 129 * (Lower or Raise) 130 * ,-----------------------------------------------------------------------------------. 131 * | | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 |BackSp| 132 * |------+------+------+------+------+------|------+------+------+------+------+------| 133 * | | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10| Enter| 134 * |------+------+------+------+------+-------------+------+------+------+------+------| 135 * | | F11 | F12 | LAlt |LShift| LAlt | RAlt |RShift| , | . | / | | 136 * `------+------+------+------+------+------+------+------+------+------+------+------. 137 * | | | | | | | | | 138 * `-------------------------------------------------------' 139 */ 140 [_NUMBERS] = LAYOUT( 141 _______, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC, 142 LT(_EXTRARIGHT,KC_TAB), KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, _______, 143 _______, KC_F11, KC_F12, KC_LALT, KC_LSFT, KC_LALT, KC_RALT, KC_RSFT, KC_COMM, KC_DOT, KC_SLSH, _______, 144 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ 145 ), 146 147 /* ExtraRightSide (the keys from the right side which did not fit into the matrix) 148 * ,-----------------------------------------------------------------------------------. 149 * | Esc |BREAK |PLOVR2|PLOVER|TxBOLT|TxBlt2| ` | = | ( | ) | - | | 150 * |------+------+------+------+------+-------------+------+------+------+------+------| 151 * |******| | | | | |PrtScr| | | | ' | | 152 This is the 153 key turning 154 this layer on 155 * |------+------+------+------+------+------|------+------+------+------+------+------| 156 * | | | |NumPad|Qwerty| | | | [ | ] | \ | | 157 * `------+------+------+------+------+------+------+------+------+------+------+------. 158 * | | | | | | | | | 159 * `-------------------------------------------------------' 160 */ 161 [_EXTRARIGHT] = LAYOUT( 162 _______, KC_BRK, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_GRV, KC_EQL, KC_LPRN, KC_RPRN, KC_MINS, _______, 163 _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_PSCR, XXXXXXX, XXXXXXX, XXXXXXX, KC_QUOT, _______, 164 _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_LBRC, KC_RBRC, KC_BSLS, _______, 165 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ 166 ) 167 }; 168 169 layer_state_t layer_state_set_user(layer_state_t state) { 170 return update_tri_layer_state(state, _CURSORLEFT, _CURSORRGHT, _NUMBERS); 171 }