Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* remove ALT keys,
- * press the keycode by itself,
- * release the keycode on key up,
- * return false to avoid sending the original keypress [;'/
- */
- #define NO_ALT(kc) \
- if (record->event.pressed) { \
- del_mods(MOD_MASK_ALT); \
- register_code16(kc); \
- } else { \
- unregister_code16(kc); \
- } \
- return false;
- bool alt_down = false;
- bool process_record_user(uint16_t keycode, keyrecord_t *record) {
- //if an ALT key is held down
- if (alt_down) {
- switch (keycode) {
- case KC_LBRC: //if ALT + [
- NO_ALT(KC_UP); // press UP
- case KC_SCLN: //if ALT + ;
- NO_ALT(KC_LEFT); // press LEFT
- case KC_QUOT: //if ALT + '
- NO_ALT(KC_DOWN); // press DOWN
- case KC_SLSH: //if ALT + /
- NO_ALT(KC_RIGHT); // press RIGHT
- default:
- return true;
- }
- }
- switch (keycode) {
- case KC_LALT: //for left or right ALT,
- case KC_RALT: //set alt_down to true if pressed
- if (record->event.pressed) {
- alt_down = true;
- } else { //on ALT keyup
- alt_down = false;
- }
- break;
- return true;
- }
Add Comment
Please, Sign In to add comment