The next macro creates a custom key, that prints KC_QUOT, and KC_LBRC while shift is pressed. Both keys support standar key repetition while keys are holded.
case CKC_ACCENT: // ´ and `
if (record->event.pressed) {
if (!(get_mods() & MOD_BIT(KC_LSHIFT) || get_mods() & MOD_BIT(KC_RSHIFT))){
register_code(KC_QUOT); // If shift is not pressed, print this.
} else{
clear_mods(); // We clear shift here so we can indicate exactly the keycode we want it to print.
register_code(KC_LBRC); // While shift is pressed, print this
}
}else {
clear_keyboard();
}
return false;
The problem is, if you press SHIFT+KC_QUOT, release KC_QUOT and then press it again without releasing SHIFT, it will print KC_QUOT instead of KC_LBRC. This happens because in order to print a non standar value when shift is pressed, you must call clear_mods().
In resume:
Please, could you provide an example of a custom key than behaves like an standar key on keyholding? Or is this a bug? Thank you.
The next macro creates a custom key, that prints KC_QUOT, and KC_LBRC while shift is pressed. Both keys support standar key repetition while keys are holded.
The problem is, if you press SHIFT+KC_QUOT, release KC_QUOT and then press it again without releasing SHIFT, it will print KC_QUOT instead of KC_LBRC. This happens because in order to print a non standar value when shift is pressed, you must call clear_mods().
In resume: Please, could you provide an example of a custom key than behaves like an standar key on keyholding? Or is this a bug? Thank you.