From 5faa23d54ca1e3ab83097f2a07922f48800616e6 Mon Sep 17 00:00:00 2001 From: Nick Brassel Date: Mon, 15 May 2023 22:27:37 +1000 Subject: Keymap introspection for combos. (#19670) --- users/art/funcs/string_funcs.c | 48 +++++++++++----------- users/danielo515/combo.c | 2 +- users/danielo515/config.h | 1 - users/ericgebhart/extensions/keymap_combo.h | 3 -- users/ibnuda/combo.h | 4 +- users/ibnuda/config.h | 3 +- users/issmirnov/config.h | 1 - users/issmirnov/issmirnov.c | 4 +- users/kuchosauronad0/combo.h | 5 +-- users/kuchosauronad0/config.h | 1 - users/manna-harbour_miryoku/config.h | 1 - .../manna-harbour_miryoku/manna-harbour_miryoku.c | 2 +- users/muppetjones/config.h | 2 - users/muppetjones/features/combos.c | 3 +- users/narze/superduper.c | 2 +- users/ninjonas/combos.c | 4 +- users/ninjonas/config.h | 2 - users/pdl/pdl.c | 2 +- users/talljoe/config.h | 1 - users/uqs/uqs.c | 2 - users/yet-another-developer/combo.h | 5 +-- users/yet-another-developer/config.h | 1 - users/zigotica/combos.c | 5 +-- 23 files changed, 39 insertions(+), 65 deletions(-) (limited to 'users') diff --git a/users/art/funcs/string_funcs.c b/users/art/funcs/string_funcs.c index 319b1310e4..1ea86779cc 100644 --- a/users/art/funcs/string_funcs.c +++ b/users/art/funcs/string_funcs.c @@ -37,10 +37,8 @@ enum combo_events { ED_ENTER, ED_CS_ENTER, - BSPC_LSFT_CLEAR, - COMBO_LENGTH + BSPC_LSFT_CLEAR }; -uint16_t COMBO_LEN = COMBO_LENGTH; // do not remove - needed for combos to work const uint16_t PROGMEM combo_up[] = {KC_W, KC_R, COMBO_END}; const uint16_t PROGMEM combo_left[] = {KC_S, KC_E, COMBO_END}; @@ -122,7 +120,7 @@ void process_combo_event(uint16_t combo_index, bool pressed) { tap_code16(A(KC_RIGHT)); } } - break; + break; case BSPC_LSFT_CLEAR: if (pressed) { tap_code16(KC_END); @@ -134,7 +132,7 @@ void process_combo_event(uint16_t combo_index, bool pressed) { if (pressed) { tap_code16(C(S(KC_ENTER))); } - break; + break; } } @@ -210,63 +208,63 @@ void send_string_with_translation(char *string) { case 'w': toPrint = 'd'; - break; + break; case 'e': toPrint = 'r'; - break; + break; case 'r': toPrint = 'w'; - break; + break; case 't': toPrint = 'b'; - break; + break; case 'y': toPrint = 'j'; - break; + break; case 'u': toPrint = 'f'; - break; + break; case 'i': toPrint = 'u'; - break; + break; case 'o': toPrint = 'p'; - break; + break; case 'p': toPrint = ';'; - break; + break; case 'd': toPrint = 'h'; - break; + break; case 'f': toPrint = 't'; - break; + break; case 'h': toPrint = 'y'; - break; + break; case 'j': toPrint = 'n'; - break; + break; case 'k': toPrint = 'e'; - break; + break; case 'l': toPrint = 'o'; - break; + break; case ';': toPrint = 'i'; - break; + break; case 'b': toPrint = 'm'; - break; + break; case 'n': toPrint = 'k'; - break; + break; case 'm': toPrint = 'l'; - break; + break; } if (isUpperCase) { isUpperCase = 0; @@ -306,4 +304,4 @@ void send_shifted_strings_add(char *string1, char *string2) { send_string(string2); char_to_bspace = strlen(string1) + strlen(string2); } -} \ No newline at end of file +} diff --git a/users/danielo515/combo.c b/users/danielo515/combo.c index b33cb838bc..dae53f6e85 100644 --- a/users/danielo515/combo.c +++ b/users/danielo515/combo.c @@ -26,7 +26,7 @@ const uint16_t PROGMEM n_m[] = {KC_N, KC_M, COMBO_END}; const uint16_t PROGMEM o_p_combo[] = {KC_O, KC_P, COMBO_END}; const uint16_t PROGMEM m_cm_dot_combo[] = {KC_M, KC_COMMA, KC_DOT, COMBO_END}; -combo_t key_combos[COMBO_COUNT] = { +combo_t key_combos[] = { [JK_ESC] = COMBO(jk_combo, KC_ESC), [YU_COM] = COMBO(yu_combo, KC_AMPR), [UI_COM] = COMBO(ui_combo, KC_CIRC), diff --git a/users/danielo515/config.h b/users/danielo515/config.h index 11007eb27f..c5f9b08389 100644 --- a/users/danielo515/config.h +++ b/users/danielo515/config.h @@ -1,7 +1,6 @@ #pragma once #if defined(COMBO_ENABLE) -# define COMBO_COUNT 11 # define COMBO_TERM 25 #endif // !COMBO_ENABLE // Timeout settings for leader key diff --git a/users/ericgebhart/extensions/keymap_combo.h b/users/ericgebhart/extensions/keymap_combo.h index cd9684e601..e918fa08ea 100644 --- a/users/ericgebhart/extensions/keymap_combo.h +++ b/users/ericgebhart/extensions/keymap_combo.h @@ -52,10 +52,7 @@ void process_combo_event(uint16_t combo_index, bool pressed); #define TOGG A_ENUM enum combos { #include "combos.def" - COMBO_LENGTH }; -// Export length to combo module -uint16_t COMBO_LEN = COMBO_LENGTH; // Bake combos into mem #undef COMB diff --git a/users/ibnuda/combo.h b/users/ibnuda/combo.h index d7e79764a9..c4fd5f12ed 100644 --- a/users/ibnuda/combo.h +++ b/users/ibnuda/combo.h @@ -64,7 +64,7 @@ const uint16_t PROGMEM rl_i_ii_combo[] = {RLI, RLII, COMBO_END}; // both hand combinations. const uint16_t PROGMEM bl_m_m_combo[] = {LLM, RLM, COMBO_END}; -combo_t key_combos[COMBO_COUNT] = { +combo_t key_combos[] = { // left hand combinations. [R_U_PINKY_RING] = COMBO(lu_p_r_combo, KC_TAB), [R_U_RING_MIDDLE] = COMBO(lu_r_m_combo, KC_QUES), @@ -93,4 +93,4 @@ combo_t key_combos[COMBO_COUNT] = { // both hand combinations. [B_L_MIDDLE_MIDDLE] = COMBO(bl_m_m_combo, KC_ENT), -}; \ No newline at end of file +}; diff --git a/users/ibnuda/config.h b/users/ibnuda/config.h index c4fec5bc2d..957d24a04c 100644 --- a/users/ibnuda/config.h +++ b/users/ibnuda/config.h @@ -1,6 +1,5 @@ #pragma once #define COMBO_TERM 50 -#define COMBO_COUNT 50 -#define PERMISSIVE_HOLD \ No newline at end of file +#define PERMISSIVE_HOLD diff --git a/users/issmirnov/config.h b/users/issmirnov/config.h index 5fe78f7a53..a74f6fbc91 100644 --- a/users/issmirnov/config.h +++ b/users/issmirnov/config.h @@ -21,7 +21,6 @@ #define ONESHOT_TIMEOUT 2000 // Enable combos for vim -#define COMBO_COUNT 5 // Specify the number of combos used. BE SURE TO INCREMENT AS NEEDED #define COMBO_TERM 50 // window in milliseconds to trigger combo // Allow more than 4 keys to be sent to the system. Useful for gaming. diff --git a/users/issmirnov/issmirnov.c b/users/issmirnov/issmirnov.c index 45ef7b19a7..ecfb423ee2 100644 --- a/users/issmirnov/issmirnov.c +++ b/users/issmirnov/issmirnov.c @@ -15,9 +15,7 @@ const uint16_t PROGMEM sd_combo[] = {KC_S, KC_D, COMBO_END}; const uint16_t PROGMEM copy_combo[] = {KC_X, KC_C, COMBO_END}; const uint16_t PROGMEM paste_combo[] = {KC_X, KC_V, COMBO_END}; - -// BE SURE TO UPDATE THE CONFIG.H "COMBO_COUNT" value when you add elements here! -combo_t key_combos[COMBO_COUNT] = { +combo_t key_combos[] = { COMBO(jk_combo, KC_ESC), COMBO(df_combo, KC_COLON), COMBO(sd_combo, KC_SLASH), diff --git a/users/kuchosauronad0/combo.h b/users/kuchosauronad0/combo.h index e2ff09ab5a..6fb3eaf58c 100644 --- a/users/kuchosauronad0/combo.h +++ b/users/kuchosauronad0/combo.h @@ -1,4 +1,4 @@ -#pragma once +#pragma once #include "quantum.h" enum combo_events { ZV_COPY, @@ -12,10 +12,9 @@ const uint16_t PROGMEM cut_combo[] = {KC_X, KC_V, COMBO_END}; const uint16_t PROGMEM paste_combo[] = {KC_C, KC_V, COMBO_END}; const uint16_t PROGMEM sleep_combo[] = {KC_Q, KC_P, COMBO_END}; -combo_t key_combos[COMBO_COUNT] = { +combo_t key_combos[] = { [ZV_COPY] = COMBO_ACTION(copy_combo), [XV_CUT] = COMBO_ACTION(cut_combo), [CV_PASTE] = COMBO_ACTION(paste_combo), [QP_SLEEP] = COMBO_ACTION(sleep_combo), }; - diff --git a/users/kuchosauronad0/config.h b/users/kuchosauronad0/config.h index 28e41215b9..58ef7a20f8 100644 --- a/users/kuchosauronad0/config.h +++ b/users/kuchosauronad0/config.h @@ -56,7 +56,6 @@ #endif // !LEADER_ENABLE #if defined(COMBO_ENABLE) -# define COMBO_COUNT 4 # define COMBO_TERM 150 #endif // !COMBO_ENABLE diff --git a/users/manna-harbour_miryoku/config.h b/users/manna-harbour_miryoku/config.h index 3656e9eded..f2bc9c331b 100644 --- a/users/manna-harbour_miryoku/config.h +++ b/users/manna-harbour_miryoku/config.h @@ -34,7 +34,6 @@ // Thumb Combos #if defined (MIRYOKU_KLUDGE_THUMBCOMBOS) - #define COMBO_COUNT 8 #define COMBO_TERM 200 #define EXTRA_SHORT_COMBOS #endif diff --git a/users/manna-harbour_miryoku/manna-harbour_miryoku.c b/users/manna-harbour_miryoku/manna-harbour_miryoku.c index 389580759b..58b68c2727 100644 --- a/users/manna-harbour_miryoku/manna-harbour_miryoku.c +++ b/users/manna-harbour_miryoku/manna-harbour_miryoku.c @@ -74,7 +74,7 @@ const uint16_t PROGMEM thumbcombos_sym[] = {KC_UNDS, KC_LPRN, COMBO_END}; const uint16_t PROGMEM thumbcombos_sym[] = {KC_RPRN, KC_UNDS, COMBO_END}; #endif const uint16_t PROGMEM thumbcombos_fun[] = {KC_SPC, KC_TAB, COMBO_END}; -combo_t key_combos[COMBO_COUNT] = { +combo_t key_combos[] = { COMBO(thumbcombos_base_right, LT(U_FUN, KC_DEL)), COMBO(thumbcombos_base_left, LT(U_MEDIA, KC_ESC)), COMBO(thumbcombos_nav, KC_DEL), diff --git a/users/muppetjones/config.h b/users/muppetjones/config.h index cbc318d24f..742a97950d 100644 --- a/users/muppetjones/config.h +++ b/users/muppetjones/config.h @@ -35,6 +35,4 @@ #endif - -#define COMBO_COUNT 3 #define COMBO_TERM 40 diff --git a/users/muppetjones/features/combos.c b/users/muppetjones/features/combos.c index a6d14bb25c..a357b3ad4e 100644 --- a/users/muppetjones/features/combos.c +++ b/users/muppetjones/features/combos.c @@ -27,8 +27,7 @@ const uint16_t PROGMEM h_comm_tab[] = {KC_H, KC_COMM, COMBO_END}; const uint16_t PROGMEM l_u_scln[] = {KC_L, KC_U, COMBO_END}; const uint16_t PROGMEM j_m_caps[] = {KC_J, KC_M, COMBO_END}; -// COMBO_COUNT defined in config.h -combo_t key_combos[COMBO_COUNT] = { +combo_t key_combos[] = { [H_COMM_TAB] = COMBO(h_comm_tab, KC_TAB), [L_U_SCLN] = COMBO(l_u_scln, KC_SCLN), [J_M_CAPS] = COMBO(j_m_caps, KC_CAPS), diff --git a/users/narze/superduper.c b/users/narze/superduper.c index b497ce2e68..7545685727 100644 --- a/users/narze/superduper.c +++ b/users/narze/superduper.c @@ -24,7 +24,7 @@ const uint16_t PROGMEM superduper_combos[SUPERDUPER_COMBO_COUNT][3] = { [_QWOC] = {CM_S, CM_D, COMBO_END}, }; -combo_t key_combos[COMBO_COUNT] = { +combo_t key_combos[] = { [CB_SUPERDUPER] = COMBO_ACTION(superduper_combos[_QWERTY]), }; diff --git a/users/ninjonas/combos.c b/users/ninjonas/combos.c index 8d1cd6510f..3346af4ce4 100644 --- a/users/ninjonas/combos.c +++ b/users/ninjonas/combos.c @@ -15,7 +15,7 @@ const uint16_t PROGMEM tab_combo[] = {KC_Q, KC_T, COMBO_END}; const uint16_t PROGMEM copy_combo[] = {KC_Z, KC_C, COMBO_END}; const uint16_t PROGMEM paste_combo[] = {KC_X, KC_V, COMBO_END}; -combo_t key_combos[COMBO_COUNT] = { +combo_t key_combos[] = { [EQ_QUIT] = COMBO_ACTION(quit_combo), [RW_CLOSE] = COMBO_ACTION(close_combo), [QT_TAB] = COMBO_ACTION(tab_combo), @@ -52,4 +52,4 @@ void process_combo_event(uint16_t combo_index, bool pressed) { break; } } -#endif \ No newline at end of file +#endif diff --git a/users/ninjonas/config.h b/users/ninjonas/config.h index 565e40e841..17bb03865c 100644 --- a/users/ninjonas/config.h +++ b/users/ninjonas/config.h @@ -15,8 +15,6 @@ #define MOUSEKEY_WHEEL_DELAY 0 #ifdef COMBO_ENABLE - #undef COMBO_COUNT #undef COMBO_TERM - #define COMBO_COUNT 5 #define COMBO_TERM 60 #endif diff --git a/users/pdl/pdl.c b/users/pdl/pdl.c index 5b90a0b310..1ad2e02c12 100644 --- a/users/pdl/pdl.c +++ b/users/pdl/pdl.c @@ -181,7 +181,7 @@ const uint16_t PROGMEM xcombo_redo[] = {KC_B, KC_H, COMBO_END}; const uint16_t PROGMEM xcombo_pgup[] = {KC_G, KC_B, COMBO_END}; const uint16_t PROGMEM xcombo_pgdn[] = {KC_G, KC_K, COMBO_END}; -combo_t key_combos[COMBO_COUNT] = { +combo_t key_combos[] = { [VCOMBO_PU] = COMBO(vcombo_pu, KC_CIRC), [VCOMBO_NU] = COMBO(vcombo_nu, KC_LBRC), [VCOMBO_EU] = COMBO(vcombo_eu, LSFT(KC_9)), diff --git a/users/talljoe/config.h b/users/talljoe/config.h index dcdbbd89f4..6cf0605be3 100644 --- a/users/talljoe/config.h +++ b/users/talljoe/config.h @@ -19,5 +19,4 @@ #define RESET_LAYER 15 -#define COMBO_COUNT 2 #define COMBO_TERM 250 diff --git a/users/uqs/uqs.c b/users/uqs/uqs.c index 83733bbe2a..cd5e86bdcb 100644 --- a/users/uqs/uqs.c +++ b/users/uqs/uqs.c @@ -125,8 +125,6 @@ const uint16_t PROGMEM my_combos[][4] = { {KC_BTN1, KC_BTN2, KC_BTN3, COMBO_END}, }; -const uint16_t COMBO_LEN = ARRAY_SIZE(my_action_combos) + ARRAY_SIZE(my_combos); - #define MY_ACTION_COMBO(ck) \ [ck] = { .keys = &(my_action_combos[ck][0]) } #define MY_COMBO(ck) \ diff --git a/users/yet-another-developer/combo.h b/users/yet-another-developer/combo.h index e2ff09ab5a..6fb3eaf58c 100644 --- a/users/yet-another-developer/combo.h +++ b/users/yet-another-developer/combo.h @@ -1,4 +1,4 @@ -#pragma once +#pragma once #include "quantum.h" enum combo_events { ZV_COPY, @@ -12,10 +12,9 @@ const uint16_t PROGMEM cut_combo[] = {KC_X, KC_V, COMBO_END}; const uint16_t PROGMEM paste_combo[] = {KC_C, KC_V, COMBO_END}; const uint16_t PROGMEM sleep_combo[] = {KC_Q, KC_P, COMBO_END}; -combo_t key_combos[COMBO_COUNT] = { +combo_t key_combos[] = { [ZV_COPY] = COMBO_ACTION(copy_combo), [XV_CUT] = COMBO_ACTION(cut_combo), [CV_PASTE] = COMBO_ACTION(paste_combo), [QP_SLEEP] = COMBO_ACTION(sleep_combo), }; - diff --git a/users/yet-another-developer/config.h b/users/yet-another-developer/config.h index e783d08dc5..4836822eb4 100644 --- a/users/yet-another-developer/config.h +++ b/users/yet-another-developer/config.h @@ -17,7 +17,6 @@ #endif // !LEADER_ENABLE #if defined(COMBO_ENABLE) - #define COMBO_COUNT 4 #define COMBO_TERM 150 #endif // !COMBO_ENABLE diff --git a/users/zigotica/combos.c b/users/zigotica/combos.c index a4d4f15618..3f37f3c859 100644 --- a/users/zigotica/combos.c +++ b/users/zigotica/combos.c @@ -15,10 +15,8 @@ along with this program. If not, see . enum combos { EM_EMAIL, - CL_CAPSL, - COMBO_LENGTH + CL_CAPSL }; -uint16_t COMBO_LEN = COMBO_LENGTH; const uint16_t PROGMEM email_combo[] = {LT(_SYM, KC_E), KC_M, COMBO_END}; const uint16_t PROGMEM caps_combo[] = {KC_C, KC_L, COMBO_END}; @@ -37,4 +35,3 @@ void process_combo_event(uint16_t combo_index, bool pressed) { break; } } - -- cgit v1.2.3