space as underscore changes
This commit is contained in:
parent
c02b0c5afd
commit
e873cda670
@ -43,6 +43,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// clang-format on
|
// clang-format on
|
||||||
|
bool spc_mins_active = false;
|
||||||
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||||
uint8_t mod_state = get_mods();
|
uint8_t mod_state = get_mods();
|
||||||
|
|
||||||
@ -50,16 +51,18 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
|||||||
case KC_SPC:
|
case KC_SPC:
|
||||||
// If the keypress is space and we only have shift pressed, send KC_MINS (which when shifted gives underscore) instead of KC_SPC.
|
// If the keypress is space and we only have shift pressed, send KC_MINS (which when shifted gives underscore) instead of KC_SPC.
|
||||||
// This will allow us to still use key combos that include space _and_ shift _and_ some other modifier.
|
// This will allow us to still use key combos that include space _and_ shift _and_ some other modifier.
|
||||||
if (mod_state & MOD_MASK_SHIFT && !(mod_state & MOD_MASK_CAG)) {
|
if (spc_mins_active) {
|
||||||
|
unregister_code(KC_MINS);
|
||||||
|
spc_mins_active = false;
|
||||||
|
return false;
|
||||||
|
} else if (mod_state & MOD_MASK_SHIFT && !(mod_state & MOD_MASK_CAG)) {
|
||||||
if (record->event.pressed) {
|
if (record->event.pressed) {
|
||||||
register_code(KC_MINS);
|
register_code(KC_MINS);
|
||||||
} else {
|
spc_mins_active = true;
|
||||||
unregister_code(KC_MINS);
|
return false;
|
||||||
}
|
}
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user