[Keymap] Update personal userspace and keymaps (#6654)

* Enable Fn layer tap dances only if LAYER_FN is defined

* Update KBD6X keymap spacing to match LAYOUT spacing

* Add regular FNLK to userspace, update keymap comment labels

* Rename KC_BRK → BREAK, KC_SYSR → SYSRQ in userspace

* Change mousekey positions in KBD6X

* Disable Console in KBD6X to reduce firmware size

* Return false in process_record_* only when overriding existing keys

* Fix Caps light not working after LSFT_FN

* Refactor Fn/Caps light, fix sequencing issues
This commit is contained in:
Konstantin Đorđević 2019-09-03 17:42:05 +02:00 committed by Drashna Jaelre
parent 55bae0a5b4
commit d633cf3ccb
9 changed files with 77 additions and 61 deletions

View File

@ -24,51 +24,66 @@ bool process_record_keymap(uint16_t keycode, keyrecord_t *record) {
unregister_code(KC_RCTRL);
layer_off(L_RCTRL);
}
return false;
break;
}
default:
return true;
}
}
static bool skip_caps = false;
static void fn_light(uint32_t state) {
if (IS_LAYER_ON_STATE(state, L_FN)) {
static inline void fn_light() {
rgblight_mode_noeeprom(RGBLIGHT_MODE_STATIC_LIGHT);
rgblight_sethsv_noeeprom(modern_dolch_red.h, modern_dolch_red.s, rgblight_get_val());
skip_caps = true;
} else {
}
static inline void caps_light() {
rgblight_mode_noeeprom(RGBLIGHT_MODE_STATIC_LIGHT);
rgblight_sethsv_noeeprom(modern_dolch_cyan.h, modern_dolch_cyan.s, rgblight_get_val());
}
static inline void restore_light() {
rgblight_config_t saved = { .raw = eeconfig_read_rgblight() };
rgblight_sethsv_noeeprom(saved.hue, saved.sat, saved.val);
rgblight_mode_noeeprom(saved.mode);
}
// caps_light will be called automatically after this
static void check_light_layer(uint32_t state) {
if (IS_LAYER_ON_STATE(state, L_FN)) {
fn_light();
} else if (IS_HOST_LED_ON(USB_LED_CAPS_LOCK)) {
caps_light();
} else {
restore_light();
}
}
static void caps_light(uint8_t usb_led) {
if (skip_caps) {
skip_caps = false;
return; // Skip calls triggered by the Fn layer turning on
}
static void check_light_led(uint8_t usb_led) {
if (IS_LED_ON(usb_led, USB_LED_CAPS_LOCK)) {
rgblight_mode_noeeprom(RGBLIGHT_MODE_STATIC_LIGHT);
rgblight_sethsv_noeeprom(modern_dolch_cyan.h, modern_dolch_cyan.s, rgblight_get_val());
caps_light();
} else if (IS_LAYER_ON(L_FN)) {
fn_light();
} else {
fn_light(layer_state); // Caps is off, check if Fn light should be on
restore_light();
}
}
static bool skip_led = false;
uint32_t layer_state_set_keymap(uint32_t state) {
static uint32_t prev_state = L_BASE;
if (IS_LAYER_ON_STATE(state, L_FN) != IS_LAYER_ON_STATE(prev_state, L_FN)) {
fn_light(state); // Fn state changed since last time
check_light_layer(state); // Fn state changed since last time
skip_led = IS_LAYER_ON_STATE(state, L_FN);
// led_set_keymap will be called automatically after this
}
return prev_state = state;
}
void led_set_keymap(uint8_t usb_led) {
caps_light(usb_led);
if (skip_led) {
skip_led = false;
return; // Skip calls triggered by the Fn layer turning on
}
check_light_led(usb_led);
}
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
@ -80,7 +95,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
*
* LCtCps A S D F G H J K L ; ' Enter
*
* LShiftFn Z X C V B N M , . / RShiftFnL
* LShiftFn Z X C V B N M , . / RShiftFnF
*
* LGuLAlt Space RAlGuRCt
*
@ -97,20 +112,20 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
*
* F1 F2 F3 F4 F5 F6 F7 F8 F9 F10F11F12PScIns
*
* Hom EndPgU M3 M1 M M2 Del
* Hom EndPgU M1 M М2 M3 Del
*
* PgD MWM M
* PgD M M M
*
* MutVo-Vo+PlyPrvNxtAppMWMWM
* MutVo-Vo+PlyPrvNxtAppMWM4 М5
*
* MW MAcl2
*
*/
[L_FN] = LAYOUT(
_______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_PSCR, KC_INS,
_______, KC_HOME, KC_UP, KC_END, KC_PGUP, _______, _______, _______, _______, KC_BTN3, KC_BTN1, KC_MS_U, KC_BTN2, KC_DEL,
_______, KC_LEFT, KC_DOWN, KC_RGHT, KC_PGDN, _______, _______, _______, _______, KC_WH_U, KC_MS_L, KC_MS_R, _______,
_______, KC_MUTE, KC_VOLD, KC_VOLU, KC_MPLY, KC_MPRV, KC_MNXT, KC_APP, KC_WH_L, KC_WH_R, KC_MS_D, _______, _______,
_______, KC_HOME, KC_UP, KC_END, KC_PGUP, _______, _______, _______, _______, KC_BTN1, KC_MS_U, KC_BTN2, KC_BTN3, KC_DEL,
_______, KC_LEFT, KC_DOWN, KC_RGHT, KC_PGDN, _______, _______, _______, _______, KC_MS_L, KC_MS_D, KC_MS_R, _______,
_______, KC_MUTE, KC_VOLD, KC_VOLU, KC_MPLY, KC_MPRV, KC_MNXT, KC_APP, KC_WH_U, KC_BTN4, KC_BTN5, _______, _______,
XXXXXXX, _______, _______, KC_WH_D, KC_ACL2, _______, XXXXXXX
),
@ -122,7 +137,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
*
* MvMvMvTNx
*
* RTgRV-RV+RMd M4 M5
* RTgRV-RV+RMd
*
* DPRDstNA
*
@ -131,7 +146,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, CLEAR,
_______, TOP, MV_UP, BOTTOM, TAB_PRV, _______, _______, _______, _______, _______, _______, _______, _______, DEL_NXT,
_______, MV_LEFT, MV_DOWN, MV_RGHT, TAB_NXT, _______, _______, _______, _______, _______, _______, _______, _______,
_______, RGB_TOG, RGB_VAD, RGB_VAI, RGB_MOD, _______, _______, _______, KC_BTN4, KC_BTN5, _______, _______, _______,
_______, RGB_TOG, RGB_VAD, RGB_VAI, RGB_MOD, _______, _______, _______, _______, _______, _______, _______, _______,
XXXXXXX, DST_P_R, DST_N_A, _______, _______, _______, XXXXXXX
),
};

View File

@ -1,7 +1,7 @@
BACKLIGHT_ENABLE = no
BOOTMAGIC_ENABLE = no
COMMAND_ENABLE = yes
CONSOLE_ENABLE = yes
CONSOLE_ENABLE = no
EXTRAKEY_ENABLE = yes
MOUSEKEY_ENABLE = yes
NKRO_ENABLE = yes

View File

@ -15,7 +15,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
*
* LSftRAG Z X C V B N M , . / RShift
*
* LCtlLGuiLAlt Space RAltRGuiFnLkRCtl
* LCtlLGuiLAlt Space RAltRGuiFnFLRCtl
*
*/
[L_BASE] = LAYOUT_tkl_iso(

View File

@ -20,11 +20,10 @@ bool process_record_keymap(uint16_t keycode, keyrecord_t *record) {
cidx = (cidx + 1) % cnum;
rgblight_sethsv(colors[cidx]->h, colors[cidx]->s, colors[cidx]->v);
}
return false;
default:
return true;
break;
}
return true;
}
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
@ -40,7 +39,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
*
* LSftRAG Z X C V B N M , . / RSfRCt P1 P2 P3
* PEn
* LCtlLGuiLAlt Space RAlGuFnLk P0 P.
* LCtlLGuiLAlt Space RAlGuFnFLk P0 P.
*
*/
[L_BASE] = LAYOUT(
@ -68,7 +67,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
*
*/
[L_FN] = LAYOUT(
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_SYSR, KC_SLCK, KC_PAUS, KC_BRK, TOP, BOTTOM,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, SYSRQ, KC_SLCK, KC_PAUS, BREAK, TOP, BOTTOM,
_______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, _______, RGB_TOG, DIVIDE, TIMES, MINUS,
KC_BTN4, KC_BTN2, KC_MS_U, KC_BTN1, KC_BTN3, KC_BTN5, _______, UC_MOD, _______, KC_MSTP, KC_MPLY, KC_MPRV, KC_MNXT, CLEAR, RGB_HUI, RGB_SAI, RGB_VAI, XXXXXXX,
_______, KC_MS_L, KC_MS_D, KC_MS_R, KC_WH_U, _______, _______, _______, _______, _______, _______, _______, _______, RGB_HUD, RGB_SAD, RGB_VAD, RGB_SET,

View File

@ -12,7 +12,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
*
* LShift Z X C V B N M , . / RSfRCt PgD
*
* LCtlLGuiLAlt Space RAlGFnLk
* LCtlLGuiLAlt Space RAlGFnFL
*
*/
[L_BASE] = LAYOUT_truefox(

View File

@ -40,7 +40,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
if (record->event.pressed && record->tap.count == TAPPING_TOGGLE) {
fn_lock = !IS_LAYER_ON(L_FN); // Fn layer will be toggled after this
}
return true;
break;
#endif
case KC_ESC:
@ -58,7 +58,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
}
#endif
}
return true;
break;
case CLEAR:
if (record->event.pressed) {
@ -66,25 +66,24 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
SEND_STRING(SS_LCTRL("a") SS_TAP(X_DELETE));
)
}
return false;
break;
case DST_P_R:
kc = (get_mods() & DST_MOD_MASK) ? DST_REM : DST_PRV;
CLEAN_MODS(
(record->event.pressed ? register_code16 : unregister_code16)(kc);
)
return false;
break;
case DST_N_A:
kc = (get_mods() & DST_MOD_MASK) ? DST_ADD : DST_NXT;
CLEAN_MODS(
(record->event.pressed ? register_code16 : unregister_code16)(kc);
)
return false;
default:
return true;
break;
}
return true;
}
__attribute__((weak))

View File

@ -13,6 +13,7 @@
#ifdef LAYER_FN
#define FN MO(L_FN)
#define FNLK TG(L_FN)
#define FN_CAPS LT(L_FN, KC_CAPS)
#define FN_ESC LT(L_FN, KC_ESC)
#define FN_FNLK TT(L_FN)
@ -22,9 +23,8 @@
#define NUMPAD TG(L_NUMPAD)
#endif
#define KC_SYSR LALT(KC_PSCR)
#undef KC_BRK
#define KC_BRK LCTL(KC_PAUS)
#define BREAK LCTL(KC_PAUS)
#define SYSRQ LALT(KC_PSCR)
#define MV_UP LCTL(KC_UP)
#define MV_DOWN LCTL(KC_DOWN)

View File

@ -111,8 +111,9 @@ qk_tap_dance_action_t tap_dance_actions[] = {
[TD_RCT_RSF] = ACTION_TAP_DANCE_DOUBLE_MOD(KC_RCTL, KC_RSFT),
[TD_RSF_RCT] = ACTION_TAP_DANCE_DOUBLE_MOD(KC_RSFT, KC_RCTL),
#ifdef LAYER_FN
[TD_LSFT_FN] = ACTION_TAP_DANCE_MOD_LAYER(KC_LSFT, L_FN),
[TD_RCTL_FN] = ACTION_TAP_DANCE_MOD_LAYER(KC_RCTL, L_FN),
[TD_FN_RCTL] = ACTION_TAP_DANCE_LAYER_MOD(L_FN, KC_RCTL),
#endif
};

View File

@ -8,10 +8,11 @@
#define RCT_RSF TD(TD_RCT_RSF)
#define RSF_RCT TD(TD_RSF_RCT)
#ifdef LAYER_FN
#define LSFT_FN TD(TD_LSFT_FN)
#define RCTL_FN TD(TD_RCTL_FN)
#define FN_RCTL TD(TD_FN_RCTL)
#endif
enum tap_dance {
TD_DST_A_R,
@ -20,8 +21,9 @@ enum tap_dance {
TD_RCT_RSF,
TD_RSF_RCT,
#ifdef LAYER_FN
TD_LSFT_FN,
TD_RCTL_FN,
TD_FN_RCTL,
#endif
};