[Keyboard] Add optional colemak layout to keymap (#13217)

master
Christian Sandven 2021-08-13 21:28:05 +02:00 committed by GitHub
parent 3366c5628c
commit ac3b9333d8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 45 additions and 2 deletions

View File

@ -18,6 +18,7 @@
// Defines names for use in layer keycodes and the keymap
enum layer_names {
_QWERTY,
_COLEMAK,
_BASE,
_FN,
_LOWER,
@ -25,6 +26,11 @@ enum layer_names {
_CMD,
};
enum corgi_keycodes {
QWERTY = SAFE_RANGE,
COLEMAK
};
#define LOWER MO(_LOWER)
#define RAISE MO(_RAISE)
#define CMD MO(_CMD)
@ -49,6 +55,25 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
KC_MUTE
),
/* 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 | Space |Raise | Left | Down | Up |Right |
* `-----------------------------------------------------------------------------------'
*/
[_COLEMAK] = LAYOUT(
KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSPC,
KC_ESC, 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 ,
KC_LCTL, KC_LGUI, KC_LALT, CMD, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT,
KC_MUTE
),
/* Lower
* ,-----------------------------------------------------------------------------------.
* | ~ | ! | @ | # | $ | % | ^ | & | * | ( | ) | Bksp |
@ -99,9 +124,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* `-----------------------------------------------------------------------------------'
*/
[_CMD] = LAYOUT(
_______, _______, _______, _______, _______, _______, _______, _______, KC_P1, KC_P2, KC_P3, KC_PMNS,
_______, QWERTY, _______, _______, _______, _______, _______, _______, KC_P1, KC_P2, KC_P3, KC_PMNS,
_______, _______, _______, _______, _______, _______, _______, _______, KC_P4, KC_P5, KC_P6, KC_PPLS,
_______, _______, _______, _______, _______, _______, _______, _______, KC_P7, KC_P8, KC_P9, _______,
_______, _______, _______, COLEMAK, _______, _______, _______, _______, KC_P7, KC_P8, KC_P9, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, KC_P0, KC_PDOT, _______,
_______
),
@ -111,3 +136,21 @@ bool encoder_update_user(uint8_t index, bool clockwise) {
tap_code(clockwise ? KC_VOLU : KC_VOLD);
return true;
}
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case QWERTY:
if (record->event.pressed) {
set_single_persistent_default_layer(_QWERTY);
}
return false;
break;
case COLEMAK:
if (record->event.pressed) {
set_single_persistent_default_layer(_COLEMAK);
}
return false;
break;
}
return true;
}