space as underscore changes
Some checks failed
Automatic Approve / automatic_approve (push) Has been cancelled
Close stale issues and PRs / stale (push) Has been cancelled

This commit is contained in:
Ezri Brimhall 2025-12-17 15:17:27 -07:00
parent c02b0c5afd
commit e873cda670
Signed by: ezri
GPG Key ID: 058A78E5680C6F24

View File

@ -43,6 +43,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
};
// clang-format on
bool spc_mins_active = false;
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
uint8_t mod_state = get_mods();
@ -50,16 +51,18 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
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.
// 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) {
register_code(KC_MINS);
} else {
unregister_code(KC_MINS);
}
spc_mins_active = true;
return false;
}
}
break;
default:
break;
}