[Keymap] Introduced New layer & Improvements (#16921)
Co-authored-by: Ryan <fauxpark@gmail.com>
This commit is contained in:
parent
c03e18f728
commit
5e6f9dfc4d
|
@ -18,28 +18,61 @@
|
|||
|
||||
enum layers {
|
||||
_BASIC,
|
||||
_BRACKETS,
|
||||
_SELECTORS,
|
||||
_FN,
|
||||
};
|
||||
|
||||
|
||||
#define KC_X0 LT(_FN, KC_ESC)
|
||||
|
||||
static char current_alpha_oled [12] = "None";
|
||||
|
||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
/* _BASIC Layer
|
||||
* ,-------------------------------------.
|
||||
* | Toggle | Toggle | | |
|
||||
* | Block | Line | Undo | Redo |
|
||||
* | Block | Line | Undo | Search |
|
||||
* | Comment | Comment | | |
|
||||
* |---------+---------+--------+---------+
|
||||
* | | | | TO |
|
||||
* | Cut | Copy | Paste | _FN |
|
||||
* | Cut | Copy | Paste | _BASIC |
|
||||
* | | | | |
|
||||
* `-------------------------------------'
|
||||
*/
|
||||
[_BASIC] = LAYOUT_ortho_2x4(
|
||||
RCS(KC_A), C(KC_SLASH), C(KC_Z), C(KC_Y),
|
||||
C(KC_X), C(KC_C), C(KC_V), TO(_FN)
|
||||
RCS(KC_A), LCTL(KC_SLASH), LCTL(KC_Z), LCTL(KC_F),
|
||||
LCTL(KC_X), LCTL(KC_C), LCTL(KC_V), TO(_BRACKETS)
|
||||
),
|
||||
/* _BRACKETS Layer
|
||||
* ,-----------------------------------------.
|
||||
* | | | | |
|
||||
* | ( | [ | { | Bksp |
|
||||
* | | | | |
|
||||
* |---------+---------+--------+------------+
|
||||
* | | | | TO |
|
||||
* | Del | Copy | Paste | _SELECTORS |
|
||||
* | | | | |
|
||||
* `----------------------------------------'
|
||||
*/
|
||||
[_BRACKETS] = LAYOUT_ortho_2x4(
|
||||
S(KC_9), KC_LBRC, S(KC_LBRC), KC_BACKSPACE,
|
||||
KC_DEL, C(KC_C), C(KC_V), TO(_SELECTORS)
|
||||
),
|
||||
/* _SELECTORS Layer
|
||||
* ,-------------------------------------.
|
||||
* | | | | |
|
||||
* | Select | Save | Undo | Bksp |
|
||||
* | All | | | |
|
||||
* |---------+---------+--------+---------+
|
||||
* | | | | TO |
|
||||
* | Cut | Copy | Paste | _FN |
|
||||
* | | | | |
|
||||
* `-------------------------------------'
|
||||
*/
|
||||
[_SELECTORS] = LAYOUT_ortho_2x4(
|
||||
C(KC_A), C(KC_S), C(KC_Z), KC_BACKSPACE,
|
||||
C(KC_X), C(KC_C), C(KC_V), TO(_FN)
|
||||
),
|
||||
/* _FN Layer
|
||||
* ,--------------------------------------------.
|
||||
|
@ -49,7 +82,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||
* |-----------+-----------+-----------+---------+
|
||||
* | | Cycle | Toggle | TO |
|
||||
* | BackLight | BackLight | BackLight | _BASIC |
|
||||
* | Toggle | Levels | | |
|
||||
* | Toggle | Levels | Breathing | |
|
||||
* `--------------------------------------------'
|
||||
*/
|
||||
[_FN] = LAYOUT_ortho_2x4(
|
||||
|
@ -63,6 +96,89 @@ oled_rotation_t oled_init_user(oled_rotation_t rotation) {
|
|||
return OLED_ROTATION_180; // flips the display 180 degrees if offhand
|
||||
}
|
||||
|
||||
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||
if (record->event.pressed) {
|
||||
char string [33];
|
||||
switch(keycode)
|
||||
{
|
||||
//First Layer with Basic Keys
|
||||
case LCTL(KC_X):
|
||||
strncpy(current_alpha_oled, "Cut", sizeof(current_alpha_oled));
|
||||
break;
|
||||
case LCTL(KC_F):
|
||||
strncpy(current_alpha_oled, "Search", sizeof(current_alpha_oled));
|
||||
break;
|
||||
case LCTL(KC_Z):
|
||||
strncpy(current_alpha_oled, "Undo", sizeof(current_alpha_oled));
|
||||
break;
|
||||
case LCTL(KC_C):
|
||||
strncpy(current_alpha_oled, "Copy", sizeof(current_alpha_oled));
|
||||
break;
|
||||
case LCTL(KC_V):
|
||||
strncpy(current_alpha_oled, "Paste", sizeof(current_alpha_oled));
|
||||
break;
|
||||
case RCS(KC_A):
|
||||
strncpy(current_alpha_oled, "Block cmt.", sizeof(current_alpha_oled));
|
||||
break;
|
||||
case LCTL(KC_SLASH):
|
||||
strncpy(current_alpha_oled, "Line cmt.", sizeof(current_alpha_oled));
|
||||
break;
|
||||
//Second Layer with Brackets
|
||||
case S(KC_9):
|
||||
strncpy(current_alpha_oled, "()", sizeof(current_alpha_oled));
|
||||
break;
|
||||
case KC_LBRC:
|
||||
strncpy(current_alpha_oled, "[]", sizeof(current_alpha_oled));
|
||||
break;
|
||||
case S(KC_LBRC):
|
||||
strncpy(current_alpha_oled, "{}", sizeof(current_alpha_oled));
|
||||
break;
|
||||
case KC_BACKSPACE:
|
||||
strncpy(current_alpha_oled, "Backspace", sizeof(current_alpha_oled));
|
||||
break;
|
||||
case KC_DEL:
|
||||
strncpy(current_alpha_oled, "Del", sizeof(current_alpha_oled));
|
||||
break;
|
||||
// Selector Layer keys
|
||||
case C(KC_A):
|
||||
strncpy(current_alpha_oled, "Select All", sizeof(current_alpha_oled));
|
||||
break;
|
||||
case C(KC_S):
|
||||
strncpy(current_alpha_oled, "Save", sizeof(current_alpha_oled));
|
||||
break;
|
||||
// FN Layer keys
|
||||
case RGB_TOG:
|
||||
strncpy(current_alpha_oled, "RGB Toggle", sizeof(current_alpha_oled));
|
||||
break;
|
||||
case RGB_MOD:
|
||||
strncpy(current_alpha_oled, "RGB Fwd", sizeof(current_alpha_oled));
|
||||
break;
|
||||
case RGB_M_R:
|
||||
strncpy(current_alpha_oled, "RGB Rev", sizeof(current_alpha_oled));
|
||||
break;
|
||||
case RGB_MODE_SNAKE:
|
||||
strncpy(current_alpha_oled, "RGB Snk", sizeof(current_alpha_oled));
|
||||
break;
|
||||
case BL_TOGG:
|
||||
strncpy(current_alpha_oled, "BkLgt Tog", sizeof(current_alpha_oled));
|
||||
break;
|
||||
case BL_STEP:
|
||||
strncpy(current_alpha_oled, "BkLgt Lvl", sizeof(current_alpha_oled));
|
||||
break;
|
||||
case BL_BRTG:
|
||||
strncpy(current_alpha_oled, "BkLgt Brth", sizeof(current_alpha_oled));
|
||||
break;
|
||||
//FN Key keycodes
|
||||
case TO(_BASIC) ... TO(_FN):
|
||||
strncpy(current_alpha_oled, "Switcher", sizeof(current_alpha_oled));
|
||||
break;
|
||||
default:
|
||||
strncpy(current_alpha_oled, itoa(keycode, string, 10), sizeof(current_alpha_oled));
|
||||
break;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool oled_task_user(void) {
|
||||
// Host Keyboard Layer Status
|
||||
|
@ -73,6 +189,12 @@ bool oled_task_user(void) {
|
|||
case _BASIC:
|
||||
oled_write_ln_P(PSTR("Basic"), false);
|
||||
break;
|
||||
case _BRACKETS:
|
||||
oled_write_ln_P(PSTR("Brkts"), false);
|
||||
break;
|
||||
case _SELECTORS:
|
||||
oled_write_ln_P(PSTR("Selct"), false);
|
||||
break;
|
||||
case _FN:
|
||||
oled_write_ln_P(PSTR("FN"), false);
|
||||
break;
|
||||
|
@ -90,6 +212,8 @@ bool oled_task_user(void) {
|
|||
oled_write_ln_P(led_state.caps_lock ? PSTR("On") : PSTR("Off"), false);
|
||||
oled_write_P(PSTR("Backlit: "), false);
|
||||
oled_write_ln_P(is_backlight_enabled() ? PSTR("On") : PSTR("Off"), false);
|
||||
oled_write_P(PSTR("Last Key: "), false);
|
||||
oled_write_ln(current_alpha_oled, false);
|
||||
#ifdef RGBLIGHT_ENABLE
|
||||
static char rgbStatusLine1[26] = {0};
|
||||
snprintf(rgbStatusLine1, sizeof(rgbStatusLine1), "RGB Mode: %d", rgblight_get_mode());
|
||||
|
|
Loading…
Reference in a new issue