Skip to content

Instantly share code, notes, and snippets.

@aarobc
Created October 1, 2020 22:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aarobc/c2c2cb8d4f12f0c55f22e1f685a6ef4a to your computer and use it in GitHub Desktop.
Save aarobc/c2c2cb8d4f12f0c55f22e1f685a6ef4a to your computer and use it in GitHub Desktop.
iris shift+backspace = delete
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
static uint8_t saved_mods = 0;
uint16_t temp_keycode = keycode;
// Filter out the actual keycode from MT and LT keys.
if ((keycode >= QK_MOD_TAP && keycode <= QK_MOD_TAP_MAX) || (keycode >= QK_LAYER_TAP && keycode <= QK_LAYER_TAP_MAX)) {
temp_keycode &= 0xFF;
}
/* uprintf("KL: kc: %u, tk: %u, col: %u\n", keycode, temp_keycode, record->event.key.col); */
switch (temp_keycode) {
/* case BSP_DEL: */
case KC_BSPACE:
if (record->event.pressed) {
saved_mods = get_mods() & MOD_MASK_SHIFT;
if (saved_mods == MOD_MASK_SHIFT) { // Both shifts pressed
register_code(KC_DEL);
} else if (saved_mods) { // One shift pressed
del_mods(saved_mods); // Remove any Shifts present
register_code(KC_DEL);
add_mods(saved_mods); // Add shifts again
} else {
register_code(KC_BSPC);
}
} else {
unregister_code(KC_DEL);
unregister_code(KC_BSPC);
}
return false;
}
return true;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment