Use modern solution for tri-layer in sofle default layout (#19113)

This commit is contained in:
rafal0p 2022-11-20 18:23:41 +01:00 committed by GitHub
parent ca693d7f9b
commit 852952cfd8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -12,9 +12,6 @@ enum sofle_layers {
enum custom_keycodes {
KC_QWERTY = SAFE_RANGE,
KC_COLEMAK,
KC_LOWER,
KC_RAISE,
KC_ADJUST,
KC_PRVWD,
KC_NXTWD,
KC_LSTRT,
@ -45,7 +42,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
KC_ESC, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC,
KC_TAB, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT,
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_MUTE, XXXXXXX,KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT,
KC_LGUI,KC_LALT,KC_LCTRL, KC_LOWER, KC_ENT, KC_SPC, KC_RAISE, KC_RCTRL, KC_RALT, KC_RGUI
KC_LGUI,KC_LALT,KC_LCTRL, MO(_LOWER), KC_ENT, KC_SPC, MO(_RAISE), KC_RCTRL, KC_RALT, KC_RGUI
),
/*
* COLEMAK
@ -68,7 +65,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
KC_ESC, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSPC,
KC_TAB, 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_MUTE, XXXXXXX,KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT,
KC_LGUI,KC_LALT,KC_LCTRL,KC_LOWER, KC_ENT, KC_SPC, KC_RAISE, KC_RCTRL, KC_RALT, KC_RGUI
KC_LGUI,KC_LALT,KC_LCTRL, MO(_LOWER), KC_ENT, KC_SPC, MO(_RAISE), KC_RCTRL, KC_RALT, KC_RGUI
),
/* LOWER
* ,-----------------------------------------. ,-----------------------------------------.
@ -211,6 +208,10 @@ bool oled_task_user(void) {
#endif
layer_state_t layer_state_set_user(layer_state_t state) {
return update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST);
}
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case KC_QWERTY:
@ -223,31 +224,6 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
set_single_persistent_default_layer(_COLEMAK);
}
return false;
case KC_LOWER:
if (record->event.pressed) {
layer_on(_LOWER);
update_tri_layer(_LOWER, _RAISE, _ADJUST);
} else {
layer_off(_LOWER);
update_tri_layer(_LOWER, _RAISE, _ADJUST);
}
return false;
case KC_RAISE:
if (record->event.pressed) {
layer_on(_RAISE);
update_tri_layer(_LOWER, _RAISE, _ADJUST);
} else {
layer_off(_RAISE);
update_tri_layer(_LOWER, _RAISE, _ADJUST);
}
return false;
case KC_ADJUST:
if (record->event.pressed) {
layer_on(_ADJUST);
} else {
layer_off(_ADJUST);
}
return false;
case KC_PRVWD:
if (record->event.pressed) {
if (keymap_config.swap_lctl_lgui) {