Skip to content

Commit

Permalink
Use QMK's built-in tri-layer feature
Browse files Browse the repository at this point in the history
  • Loading branch information
bcat committed Jan 8, 2024
1 parent 2809399 commit d3df14f
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 14 deletions.
2 changes: 1 addition & 1 deletion keyboards/eco/keymaps/bcat/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_LBRC, KC_RBRC, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC,
KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_HOME, KC_PGUP, 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_END, KC_PGDN, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT,
XXXXXXX, XXXXXXX, KC_LALT, KC_LCTL, LY_LWR, KC_SPC, XXXXXXX, XXXXXXX, KC_ENT, LY_RSE, KC_RALT, KC_RGUI, XXXXXXX, XXXXXXX
XXXXXXX, XXXXXXX, KC_LALT, KC_LCTL, TL_LOWR, KC_SPC, XXXXXXX, XXXXXXX, KC_ENT, TL_UPPR, KC_RALT, KC_RGUI, XXXXXXX, XXXXXXX
),
[LAYER_LOWER] = LAYOUT(
MC_ALTT, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, _______, _______, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, _______,
Expand Down
2 changes: 1 addition & 1 deletion keyboards/lily58/keymaps/bcat/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC,
KC_ESC, 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_WBAK, KC_WFWD, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT,
KC_LALT, KC_LCTL, LY_LWR, KC_SPC, KC_ENT, LY_RSE, KC_RALT, KC_RGUI
KC_LALT, KC_LCTL, TL_LOWR, KC_SPC, KC_ENT, TL_UPPR, KC_RALT, KC_RGUI
),
[LAYER_LOWER] = LAYOUT(
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
Expand Down
2 changes: 1 addition & 1 deletion keyboards/yanghu/unicorne/keymaps/bcat/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC,
KC_ESC, 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_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT,
KC_MPLY, KC_LCTL, LY_LWR, KC_SPC, KC_ENT, LY_RSE, KC_RALT, KC_MUTE
KC_MPLY, KC_LCTL, TL_LOWR, KC_SPC, KC_ENT, TL_UPPR, KC_RALT, KC_MUTE
),
[LAYER_LOWER] = LAYOUT(
MC_ALTT, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, _______,
Expand Down
2 changes: 1 addition & 1 deletion layouts/split_3x6_3/bcat/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC,
KC_ESC, 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_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT,
KC_LCTL, LY_LWR, KC_SPC, KC_ENT, LY_RSE, KC_RALT
KC_LCTL, TL_LOWR, KC_SPC, KC_ENT, TL_UPPR, KC_RALT
),
[LAYER_LOWER] = LAYOUT_split_3x6_3(
MC_ALTT, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, _______,
Expand Down
3 changes: 0 additions & 3 deletions users/bcat/bcat.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,6 @@ __attribute__((weak)) layer_state_t layer_state_set_keymap(layer_state_t state)

layer_state_t layer_state_set_user(layer_state_t state) {
state = layer_state_set_keymap(state);
#if defined(BCAT_ORTHO_LAYERS)
state = update_tri_layer_state(state, LAYER_LOWER, LAYER_RAISE, LAYER_ADJUST);
#endif
if (alt_tab_layer >= 0 && !layer_state_cmp(state, alt_tab_layer)) {
unregister_code(KC_LALT);
alt_tab_layer = -1;
Expand Down
12 changes: 5 additions & 7 deletions users/bcat/bcat.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include <stdbool.h>

#include "quantum_keycodes.h"
#include "tri_layer.h"

/* Layer numbers shared across keymaps. */
enum user_layer {
Expand All @@ -27,9 +28,9 @@ enum user_layer {

#if defined(BCAT_ORTHO_LAYERS)
/* Function layers for ortho (and ergo) boards: */
LAYER_LOWER,
LAYER_RAISE,
LAYER_ADJUST,
LAYER_LOWER = TRI_LAYER_LOWER_LAYER,
LAYER_RAISE = TRI_LAYER_UPPER_LAYER,
LAYER_ADJUST = TRI_LAYER_ADJUST_LAYER,
#else
/* Function layers for traditional boards: */
LAYER_FN,
Expand All @@ -49,10 +50,7 @@ enum user_keycode {
#define KY_ZMOUT LCTL(KC_MINS)
#define KY_ZMRST LCTL(KC_0)

#if defined(BCAT_ORTHO_LAYERS)
# define LY_LWR MO(LAYER_LOWER)
# define LY_RSE MO(LAYER_RAISE)
#else
#if !defined(BCAT_ORTHO_LAYERS)
# define LY_FN MO(LAYER_FN)
# define LY_FN2 MO(LAYER_FN2)
#endif
4 changes: 4 additions & 0 deletions users/bcat/rules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ else
BOOTMAGIC_ENABLE = no
endif

# Enable tri-layer support on all keyboards. (Technically, only ortho and ergo
# keyboards need this, but it's harmless on other boards.)
TRI_LAYER_ENABLE = yes

# Enable media keys on all keyboards.
EXTRAKEY_ENABLE = yes

Expand Down

0 comments on commit d3df14f

Please sign in to comment.