mirror of
https://github.com/qmk/qmk_userspace.git
synced 2026-07-27 20:01:55 -04:00
Fixed the combo num layer issue, it was because the combo was not hold-only. Adjusted the combo term for the num layer combo to be a bit larger at 150
This commit is contained in:
parent
204f9e724e
commit
4a4f414d28
6 changed files with 21 additions and 6 deletions
|
|
@ -21,7 +21,7 @@ enum CustomKeycodes {
|
||||||
#define ZOOM_OUT C(KC_MINS)
|
#define ZOOM_OUT C(KC_MINS)
|
||||||
|
|
||||||
// layers
|
// layers
|
||||||
#define NUM MO(_NUM)
|
#define NUM MO(_NUM) // used by the NumCombo combo
|
||||||
#define SYM_BSPC LT(_SYM, KC_BSPC)
|
#define SYM_BSPC LT(_SYM, KC_BSPC)
|
||||||
#define NAV_TAB LT(_NAV, KC_TAB)
|
#define NAV_TAB LT(_NAV, KC_TAB)
|
||||||
#define FN_LAUNCH LT(_FUNC, LAUNCH)
|
#define FN_LAUNCH LT(_FUNC, LAUNCH)
|
||||||
|
|
|
||||||
|
|
@ -5,12 +5,14 @@
|
||||||
uint16_t get_combo_term(uint16_t combo_index, combo_t* combo) {
|
uint16_t get_combo_term(uint16_t combo_index, combo_t* combo) {
|
||||||
switch (combo_index) {
|
switch (combo_index) {
|
||||||
case NumCombo:
|
case NumCombo:
|
||||||
return 75; // make a larger window for triggering the combo
|
return 150; // make a larger window for triggering the combo
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return COMBO_TERM;
|
return COMBO_TERM;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// necessary to make sure the layers are turned off for the NUM layer combo, since the original
|
||||||
|
// layer keys are consumed by the combo activation
|
||||||
bool process_combo_key_release(
|
bool process_combo_key_release(
|
||||||
uint16_t combo_index, combo_t* combo, uint8_t key_index, uint16_t keycode
|
uint16_t combo_index, combo_t* combo, uint8_t key_index, uint16_t keycode
|
||||||
) {
|
) {
|
||||||
|
|
@ -31,6 +33,16 @@ bool process_combo_key_release(
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// necessary for the NUM layer combo, since it shouldn't trigger on a tap
|
||||||
|
bool get_combo_must_hold(uint16_t combo_index, combo_t* combo) {
|
||||||
|
switch (combo_index) {
|
||||||
|
case NumCombo: // make the NUM layer combo hold-only
|
||||||
|
return true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
bool process_combo_key_repress(
|
bool process_combo_key_repress(
|
||||||
uint16_t combo_index, combo_t* combo, uint8_t key_index, uint16_t keycode
|
uint16_t combo_index, combo_t* combo, uint8_t key_index, uint16_t keycode
|
||||||
) {
|
) {
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,7 @@
|
||||||
#define COMBO_PROCESS_KEY_RELEASE
|
#define COMBO_PROCESS_KEY_RELEASE
|
||||||
#define COMBO_PROCESS_KEY_REPRESS
|
#define COMBO_PROCESS_KEY_REPRESS
|
||||||
#define COMBO_TERM_PER_COMBO
|
#define COMBO_TERM_PER_COMBO
|
||||||
|
#define COMBO_MUST_HOLD_PER_COMBO
|
||||||
|
|
||||||
#define CAPS_WORD_IDLE_TIMEOUT 0
|
#define CAPS_WORD_IDLE_TIMEOUT 0
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -178,11 +178,11 @@ bool process_record_user(uint16_t keycode, keyrecord_t* record) {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case KC_SPC:
|
case KC_SPC:
|
||||||
|
// have to implement this here instead of as a key override because it was acting
|
||||||
|
// weird with layers as a key override
|
||||||
if (get_highest_layer(layer_state) == _GAME) {
|
if (get_highest_layer(layer_state) == _GAME) {
|
||||||
return true; // return early
|
return true; // return early
|
||||||
}
|
}
|
||||||
// have to implement this here instead of as a key override because it was acting
|
|
||||||
// weird with layers as a key override
|
|
||||||
if (record->event.pressed) {
|
if (record->event.pressed) {
|
||||||
uint8_t mods = get_mods();
|
uint8_t mods = get_mods();
|
||||||
if ((mods | get_oneshot_mods()) & MOD_MASK_CTRL) {
|
if ((mods | get_oneshot_mods()) & MOD_MASK_CTRL) {
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,8 @@ layer_state_t layer_state_set_user(layer_state_t state) {
|
||||||
}
|
}
|
||||||
} else if (IS_LAYER_ON_STATE(state, _NUM)) {
|
} else if (IS_LAYER_ON_STATE(state, _NUM)) {
|
||||||
NUM_latched = true;
|
NUM_latched = true;
|
||||||
state |= 1 << _NAV | 1 << _SYM; // turn on NAV and SYM too
|
// turn on NAV and SYM too, since the layer keys were consumed by the combo activation
|
||||||
|
state |= 1 << _NAV | 1 << _SYM;
|
||||||
}
|
}
|
||||||
|
|
||||||
return state;
|
return state;
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,7 @@ uint16_t get_quick_tap_term(uint16_t keycode, keyrecord_t* record) {
|
||||||
return QUICK_TAP_TERM;
|
return QUICK_TAP_TERM;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: remove
|
||||||
// bool get_hold_on_other_key_press(uint16_t keycode, keyrecord_t* record) {
|
// bool get_hold_on_other_key_press(uint16_t keycode, keyrecord_t* record) {
|
||||||
// switch (keycode) {
|
// switch (keycode) {
|
||||||
// case NUM_SPC:
|
// case NUM_SPC:
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue