Skip to content

Commit

Permalink
improve programming tapdances
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaelromao committed Aug 29, 2022
1 parent 9ed8e3b commit 7b50034
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 4 deletions.
Binary file modified img/overview.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions src/qmk/users/rafaelromao/definitions/keycodes.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ enum {
ENT_END,
SCL_END,
BRT_LCR,
BRT_RCR,
BRT_PAR,
BRT_OPA,
BRT_CPA,
Expand All @@ -28,6 +29,7 @@ enum {
#define TD_EENT TD(ENT_END)
#define TD_SCLE TD(SCL_END)
#define TD_LCRB TD(BRT_LCR)
#define TD_RCRB TD(BRT_RCR)
#define TD_PARN TD(BRT_PAR)
#define TD_OPAR TD(BRT_OPA)
#define TD_CPAR TD(BRT_CPA)
Expand Down
4 changes: 2 additions & 2 deletions src/qmk/users/rafaelromao/definitions/keymap_blocks.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
#define ____NUMPAD_R4____ RAI_BSP , MED_0

#define ___________________MACROS_L1___________________ XXXXXXX , KC_ESC , MC_COMP , MC_AUCO , MC_NEER
#define ___________________MACROS_L2___________________ XXXXXXX , SF_SE , MC_RUAN , MC_QUIK , MC_BUID
#define ___________________MACROS_L2___________________ XXXXXXX , SF_SE , MC_RUAN , MC_QUIK , MC_BUID
#define ___________________MACROS_L3___________________ XXXXXXX , MC_PROJ , MC_REFI , MC_FIUS , MC_REFC
#define ____MACROS_L4____ _______ , LOW_BSP

Expand All @@ -60,7 +60,7 @@
#define ___________________RAISE_L3____________________ KC_F14 , KC_F3 , KC_F2 , KC_F1 , KC_F10
#define ____RAISE_L4_____ _______ , _______

#define ___________________RAISE_R1____________________ MC_CIRC , TD_DLR , TD_LCRB , KC_RCBR , XXXXXXX
#define ___________________RAISE_R1____________________ MC_CIRC , TD_DLR , TD_LCRB , TD_RCRB , XXXXXXX
#define ___________________RAISE_R2____________________ KC_PLUS , KC_MINS , KC_EQL , KC_EXLM , KC_PERC
#define ___________________RAISE_R3____________________ KC_ASTR , KC_SLSH , KC_LT , KC_GT , KC_COLN
#define ____RAISE_R4_____ _______ , _______
Expand Down
2 changes: 1 addition & 1 deletion src/qmk/users/rafaelromao/features/combos.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const uint16_t PROGMEM r_low_ent_combo[] = {RAI_BSP, KC_5, KC_6, COMBO_END};

// Raise

const uint16_t PROGMEM r_rai_cur_combo[] = {TD_LCRB, KC_RCBR, COMBO_END};
const uint16_t PROGMEM r_rai_cur_combo[] = {TD_LCRB, TD_RCRB, COMBO_END};

// Media

Expand Down
2 changes: 1 addition & 1 deletion src/qmk/users/rafaelromao/features/macros.c
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ process_record_result_t process_macro_keycode(uint16_t keycode, bool isOneShotSh
// END { ENTER }

case MC_CUR:
SEND_STRING(SS_TAP(X_END) "{}" SS_TAP(X_LEFT) SS_TAP(X_ENT));
SEND_STRING(SS_TAP(X_END) "{}" SS_DELAY(50) SS_TAP(X_LEFT) SS_TAP(X_ENT));
return PROCESS_RECORD_RETURN_FALSE;

// END ; ENTER
Expand Down
19 changes: 19 additions & 0 deletions src/qmk/users/rafaelromao/features/tapdance.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,24 @@ void td_open_curly_braces(qk_tap_dance_state_t *state, void *user_data) {
}
}

void td_close_curly_braces(qk_tap_dance_state_t *state, void *user_data) {
tap_state.state = dance_state(state);
switch (tap_state.state) {
case TD_SINGLE_TAP:
tap_code16(KC_RCBR);
break;
case TD_DOUBLE_TAP:
SEND_STRING("else");
break;
case TD_SINGLE_HOLD:
tap_code16(KC_END);
tap_code16(KC_RCBR);
break;
default:
break;
}
}

void td_open_parentesis(qk_tap_dance_state_t *state, void *user_data) {
tap_state.state = dance_state(state);
switch (tap_state.state) {
Expand Down Expand Up @@ -326,6 +344,7 @@ qk_tap_dance_action_t tap_dance_actions[] = {
[ENT_END] = ACTION_TAP_DANCE_FN(td_enter_end),
[SCL_END] = ACTION_TAP_DANCE_FN(td_semicolon),
[BRT_LCR] = ACTION_TAP_DANCE_FN(td_open_curly_braces),
[BRT_RCR] = ACTION_TAP_DANCE_FN(td_close_curly_braces),
[BRT_OPA] = ACTION_TAP_DANCE_FN(td_open_parentesis),
[BRT_CPA] = ACTION_TAP_DANCE_FN(td_close_parentesis),
[BRT_PAR] = ACTION_TAP_DANCE_FN(td_parentesis),
Expand Down

0 comments on commit 7b50034

Please sign in to comment.