diff options
Diffstat (limited to 'keyboards')
-rw-r--r-- | keyboards/ergodox_ez/glow/keymaps/jworthe/keymap.c | 44 |
1 files changed, 25 insertions, 19 deletions
diff --git a/keyboards/ergodox_ez/glow/keymaps/jworthe/keymap.c b/keyboards/ergodox_ez/glow/keymaps/jworthe/keymap.c index 60f3967c8c..8ca83cd31d 100644 --- a/keyboards/ergodox_ez/glow/keymaps/jworthe/keymap.c +++ b/keyboards/ergodox_ez/glow/keymaps/jworthe/keymap.c @@ -159,6 +159,9 @@ void rgb_matrix_indicators_user(void) { } bool process_record_user(uint16_t keycode, keyrecord_t *record) { + int mod_state = get_mods(); + clear_mods(); + switch (keycode) { case SMALL_ARROW: if (record->event.pressed) { @@ -172,7 +175,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { break; case EMAIL: if (record->event.pressed) { - if (get_mods() == MOD_BIT(MOD_MASK_SHIFT)) { + if (mod_state & MOD_MASK_SHIFT) { SEND_STRING("justin.worthe@gmail.com"); } else { SEND_STRING("justin@worthe-it.co.za"); @@ -181,12 +184,11 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { break; case WHILE: if (record->event.pressed) { - if (get_mods() == MOD_BIT(MOD_MASK_SHIFT)) { + if (mod_state & MOD_MASK_SHIFT) { SEND_STRING("for"); } else { SEND_STRING("while"); } - SEND_STRING(); } break; case ENUM: @@ -196,7 +198,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { break; case BOOL: if (record->event.pressed) { - if (get_mods() == MOD_BIT(MOD_MASK_SHIFT)) { + if (mod_state & MOD_MASK_SHIFT) { SEND_STRING("false"); } else { SEND_STRING("true"); @@ -205,7 +207,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { break; case IFELSE: if (record->event.pressed) { - if (get_mods() == MOD_BIT(MOD_MASK_SHIFT)) { + if (mod_state & MOD_MASK_SHIFT) { SEND_STRING("else"); } else { SEND_STRING("if"); @@ -214,7 +216,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { break; case PUB: if (record->event.pressed) { - if (get_mods() == MOD_BIT(MOD_MASK_SHIFT)) { + if (mod_state & MOD_MASK_SHIFT) { SEND_STRING("pub(crate)"); } else { SEND_STRING("pub"); @@ -223,7 +225,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { break; case ASYNC: if (record->event.pressed) { - if (get_mods() == MOD_BIT(MOD_MASK_SHIFT)) { + if (mod_state & MOD_MASK_SHIFT) { SEND_STRING("await"); } else { SEND_STRING("async"); @@ -231,15 +233,17 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { } break; case SELF: - if (get_mods() == MOD_BIT(MOD_MASK_SHIFT)) { - SEND_STRING("Self"); - } else { - SEND_STRING("self"); + if (record->event.pressed) { + if (mod_state & MOD_MASK_SHIFT) { + SEND_STRING("Self"); + } else { + SEND_STRING("self"); + } } break; case IMPL: if (record->event.pressed) { - if (get_mods() == MOD_BIT(MOD_MASK_SHIFT)) { + if (mod_state & MOD_MASK_SHIFT) { SEND_STRING("dyn"); } else { SEND_STRING("impl"); @@ -248,7 +252,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { break; case FN: if (record->event.pressed) { - if (get_mods() == MOD_BIT(MOD_MASK_SHIFT)) { + if (mod_state & MOD_MASK_SHIFT) { SEND_STRING("function"); } else { SEND_STRING("fn"); @@ -257,7 +261,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { break; case LET: if (record->event.pressed) { - if (get_mods() == MOD_BIT(MOD_MASK_SHIFT)) { + if (mod_state & MOD_MASK_SHIFT) { SEND_STRING("const"); } else { SEND_STRING("let"); @@ -266,7 +270,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { break; case BYE: if (record->event.pressed) { - if (get_mods() == MOD_BIT(MOD_MASK_SHIFT)) { + if (mod_state & MOD_MASK_SHIFT) { SEND_STRING("Cheers," SS_TAP(X_ENTER) "Justin"); } else { SEND_STRING("Kind regards," SS_TAP(X_ENTER) "Justin Wernick"); @@ -275,7 +279,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { break; case STRUCT: if (record->event.pressed) { - if (get_mods() == MOD_BIT(MOD_MASK_SHIFT)) { + if (mod_state & MOD_MASK_SHIFT) { SEND_STRING("trait"); } else { SEND_STRING("struct"); @@ -284,7 +288,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { break; case CRATE: if (record->event.pressed) { - if (get_mods() == MOD_BIT(MOD_MASK_SHIFT)) { + if (mod_state & MOD_MASK_SHIFT) { SEND_STRING("super"); } else { SEND_STRING("crate"); @@ -293,7 +297,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { break; case BREAK: if (record->event.pressed) { - if (get_mods() == MOD_BIT(MOD_MASK_SHIFT)) { + if (mod_state & MOD_MASK_SHIFT) { SEND_STRING("continue"); } else { SEND_STRING("break"); @@ -315,8 +319,10 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { if (record->event.pressed) { rgblight_mode(1); } - return false; + break; } + + set_mods(mod_state); return true; } |