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) --- keyboards/crkbd/keymaps/antosha417/keymap.c | 8 +--- keyboards/crkbd/keymaps/cameronjlarsen/keymap.c | 7 +-- keyboards/crkbd/keymaps/markstos/config.h | 5 +- keyboards/crkbd/keymaps/markstos/keymap.c | 4 +- keyboards/crkbd/keymaps/nimishgautam/config.h | 3 +- keyboards/crkbd/keymaps/nimishgautam/keymap.c | 64 ++++++++++++------------- keyboards/crkbd/keymaps/pdl/config.h | 1 - 7 files changed, 40 insertions(+), 52 deletions(-) (limited to 'keyboards/crkbd') diff --git a/keyboards/crkbd/keymaps/antosha417/keymap.c b/keyboards/crkbd/keymaps/antosha417/keymap.c index bdee148485..47771b531e 100644 --- a/keyboards/crkbd/keymaps/antosha417/keymap.c +++ b/keyboards/crkbd/keymaps/antosha417/keymap.c @@ -165,11 +165,8 @@ enum combo_events { DELQ_COMBO, SAVEQ_COMBO, BSPCQ_COMBO, - BSPCWQ_COMBO, - - COMBO_LENGTH + BSPCWQ_COMBO }; -uint16_t COMBO_LEN = COMBO_LENGTH; const uint16_t PROGMEM ru_combo[] = {KC_R, U_CTRL, COMBO_END}; const uint16_t PROGMEM en_combo[] = {U_CTRL, S_ALT, COMBO_END}; @@ -216,7 +213,7 @@ combo_t key_combos[] = { [SAVEQ_COMBO] = COMBO(saveq_combo, VIM_SAVE), [BSPCWQ_COMBO] = COMBO(bspcwq_combo, DELETE_WORD), }; - + #ifdef OLED_ENABLE oled_rotation_t oled_init_user(oled_rotation_t rotation) { @@ -398,4 +395,3 @@ void matrix_scan_user(void) { #include "mod_tap_keys.h" #undef MOD_TAP_KEY } - diff --git a/keyboards/crkbd/keymaps/cameronjlarsen/keymap.c b/keyboards/crkbd/keymaps/cameronjlarsen/keymap.c index e7bccb5c73..54ad19dc0b 100644 --- a/keyboards/crkbd/keymaps/cameronjlarsen/keymap.c +++ b/keyboards/crkbd/keymaps/cameronjlarsen/keymap.c @@ -30,7 +30,7 @@ enum layers { // One shot mods enum keycodes { - OS_SHFT = QK_USER, + OS_SHFT = QK_USER, OS_CTRL, OS_ALT, OS_GUI, @@ -159,11 +159,8 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { }; enum combo_events { - CAPS_COMBO, - // Other combos... - COMBO_LENGTH + CAPS_COMBO }; -uint16_t COMBO_LEN = COMBO_LENGTH; const uint16_t PROGMEM caps_combo[] = {KC_F, KC_J, COMBO_END}; diff --git a/keyboards/crkbd/keymaps/markstos/config.h b/keyboards/crkbd/keymaps/markstos/config.h index 5644812e5e..24101724de 100644 --- a/keyboards/crkbd/keymaps/markstos/config.h +++ b/keyboards/crkbd/keymaps/markstos/config.h @@ -43,11 +43,9 @@ This is the C configuration file for the keymap #define QMK_SPEAKER C6 // When enabled, typing a mod-tap plus second within term will register as the mod-combo -// Ref: https://beta.docs.qmk.fm/using-qmk/software-features/tap_hold#permissive-hold +// Ref: https://beta.docs.qmk.fm/using-qmk/software-features/tap_hold#permissive-hold #define PERMISSIVE_HOLD -#define COMBO_COUNT 2 - // Set the COMBO_TERM so low that I won't type the keys one after each other during normal typing. // They would have be held together intentionally to trigger this. #define COMBO_TERM 40 @@ -56,4 +54,3 @@ This is the C configuration file for the keymap // I want a relatively low timeout, so if I accidentally type "Shift", I can pause just briefly and move on. #define ONESHOT_TAP_TOGGLE 3 /* Tapping this number of times holds the key until tapped once again. */ #define ONESHOT_TIMEOUT 2000 /* Time (in ms) before the one shot key is released */ - diff --git a/keyboards/crkbd/keymaps/markstos/keymap.c b/keyboards/crkbd/keymaps/markstos/keymap.c index ca5be183b1..1f95ee52b2 100644 --- a/keyboards/crkbd/keymaps/markstos/keymap.c +++ b/keyboards/crkbd/keymaps/markstos/keymap.c @@ -18,7 +18,7 @@ enum combos { const uint16_t PROGMEM df_combo[] = {KC_D, KC_F, COMBO_END}; const uint16_t PROGMEM jk_combo[] = {KC_J, KC_K, COMBO_END}; -combo_t key_combos[COMBO_COUNT] = { +combo_t key_combos[] = { // Add commonly used dash to home row [DF_DASH] = COMBO(df_combo, KC_MINS), // For Vim, put Escape on the home row @@ -43,7 +43,7 @@ enum custom_layers { #define GUI_ENT GUI_T(KC_ENT) #define LOW_TAB LT(_LOWER, KC_TAB) #define RSE_BSP LT(_RAISE, KC_BSPC) -#define OSM_SFT OSM(MOD_LSFT) +#define OSM_SFT OSM(MOD_LSFT) // For _RAISE layer diff --git a/keyboards/crkbd/keymaps/nimishgautam/config.h b/keyboards/crkbd/keymaps/nimishgautam/config.h index d169988be7..b4c5bc9e0a 100644 --- a/keyboards/crkbd/keymaps/nimishgautam/config.h +++ b/keyboards/crkbd/keymaps/nimishgautam/config.h @@ -15,7 +15,6 @@ // combo -#define COMBO_COUNT 7 #define EXTRA_SHORT_COMBOS //Tapping values @@ -68,7 +67,7 @@ // NOTE: the below effects are super cool but they go absolutely nuts if you manually set hsv colors (eg with layers) //#define ENABLE_RGB_MATRIX_TYPING_HEATMAP - //#define ENABLE_RGB_MATRIX_SOLID_MULTISPLASH + //#define ENABLE_RGB_MATRIX_SOLID_MULTISPLASH //#define ENABLE_RGB_MATRIX_SOLID_REACTIVE #endif diff --git a/keyboards/crkbd/keymaps/nimishgautam/keymap.c b/keyboards/crkbd/keymaps/nimishgautam/keymap.c index 0c0a3e3544..389a5bfdb1 100644 --- a/keyboards/crkbd/keymaps/nimishgautam/keymap.c +++ b/keyboards/crkbd/keymaps/nimishgautam/keymap.c @@ -20,7 +20,7 @@ enum custom_key_codes { MOVE_END_LINE_TERMINAL, // move to the end of the line in the terminal /* macros */ PASTE_VIM, // paste in vim from system register - ACIRCLE, // å + ACIRCLE, // å ADOT, // ä ODOT, // ö COMPOSE_MACRO, // compose key for mac or linux @@ -44,7 +44,7 @@ enum { #define SHOW_WINDOWS LCTL(KC_UP) //'Expose' on Mac, overview on linux. Just all the windows #define WINDOW_LEFT LCTL(LGUI(LSFT(KC_LEFT))) //custom shortcut for this feature -- make window take up 50% left screen (using gui and ctl to make it os agnostic) #define WINDOW_RIGHT LCTL(LGUI(LSFT(KC_RIGHT))) //custom shortcut for this feature -- make window take up 50% right screen (using gui and ctl to make it os agnostic)/fully custom shortcut, using ctl and gui keys so will need them both irrespective of os -#define SHOW_APP_WINDOWS LCTL(KC_DOWN) +#define SHOW_APP_WINDOWS LCTL(KC_DOWN) #define LOCK_SCREEN LCTL(LGUI(KC_Q)) //manually set this on linux to match osx default #define EURO LALT(LSFT(KC_2)) #define EMOJI_KBD LCTL(LGUI(KC_SPACE)) //manually set this on linux to match osx default, with 'emote' on linux and a custom shortcut (probably better to use compose feature) @@ -86,7 +86,7 @@ const uint16_t PROGMEM adot_combo[] = {KC_BSPC, KC_SPACE, MT(MOD_RALT,KC_L), COM // combo - press combo+ ; to get ö const uint16_t PROGMEM odot_combo[] = {KC_BSPC, KC_SPACE, MT(MOD_LCTL,KC_SCLN),COMBO_END}; -combo_t key_combos[COMBO_COUNT] = { +combo_t key_combos[] = { COMBO(compose_combo, COMPOSE_MACRO), COMBO(search_combo, FINDER), COMBO(calculator_combo, CALCULATOR), @@ -113,7 +113,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [_NUMS] = LAYOUT_split_3x6_3( //numbers //,-----------------------------------------------------. ,-----------------------------------------------------. - SCREENSHOT, KC_EXCLAIM,KC_AT, KC_HASH, KC_DOLLAR,KC_PERCENT, KC_CIRCUMFLEX, KC_7, KC_8, KC_9, KC_TRANSPARENT, KC_PIPE, + SCREENSHOT, KC_EXCLAIM,KC_AT, KC_HASH, KC_DOLLAR,KC_PERCENT, KC_CIRCUMFLEX, KC_7, KC_8, KC_9, KC_TRANSPARENT, KC_PIPE, //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| TO(_BASE), KC_LCTL, KC_LALT, KC_RSFT, KC_LGUI,KC_PLUS, KC_EQL, KC_4, KC_5, KC_6, KC_BSLS, KC_TRANSPARENT, //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| @@ -125,7 +125,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [_NUM_MASK] = LAYOUT_split_3x6_3( //NUM MASK, so I can still have backspace/enter/tab etc but with the nums, arrows and formatters too //,-----------------------------------------------------. ,-----------------------------------------------------. - KC_TRANSPARENT, KC_TRANSPARENT,KC_TRANSPARENT, KC_UP, KC_TRANSPARENT,KC_TRANSPARENT, KC_TRANSPARENT, KC_7, KC_8, KC_9, KC_TRANSPARENT, KC_TRANSPARENT, + KC_TRANSPARENT, KC_TRANSPARENT,KC_TRANSPARENT, KC_UP, KC_TRANSPARENT,KC_TRANSPARENT, KC_TRANSPARENT, KC_7, KC_8, KC_9, KC_TRANSPARENT, KC_TRANSPARENT, //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| TO(_BASE), KC_TRANSPARENT, KC_LEFT, KC_DOWN, KC_RIGHT,KC_TRANSPARENT, KC_TRANSPARENT, KC_4, KC_5, KC_6, KC_TRANSPARENT, KC_TRANSPARENT, //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| @@ -164,7 +164,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [_FN_KEYS] = LAYOUT_split_3x6_3( //fn keys, terminal text navigation keys //,-----------------------------------------------------. ,-----------------------------------------------------. - KC_TRANSPARENT, KC_LCBR,KC_LBRC, KC_RBRC, KC_RCBR, MOVE_BEGIN_LINE_TERMINAL, MOVE_END_LINE_TERMINAL, KC_F7, KC_F8, KC_F9, KC_F11, KC_TRANSPARENT, + KC_TRANSPARENT, KC_LCBR,KC_LBRC, KC_RBRC, KC_RCBR, MOVE_BEGIN_LINE_TERMINAL, MOVE_END_LINE_TERMINAL, KC_F7, KC_F8, KC_F9, KC_F11, KC_TRANSPARENT, //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| TO(_BASE), KC_LCTL, KC_LALT, KC_RSFT, KC_LGUI, KC_TRANSPARENT, KC_TRANSPARENT, KC_F4, KC_F5, KC_F6, KC_F12, KC_TRANSPARENT, //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| @@ -173,7 +173,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT , KC_HASH , KC_TRANSPARENT, KC_F10 //`--------------------------' `--------------------------' ) - + }; bool process_record_user(uint16_t keycode, keyrecord_t *record) { @@ -183,19 +183,19 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { // as of this writing, you can't do a layer tap (LT) // and also send a shifted code, like left parens - // If you call such a function, it'll do the layer shift but + // If you call such a function, it'll do the layer shift but // it'll ignore the key code on tap... this is the workaround - + case LT(_NUMS,KC_LPRN): // Shift to _NUMS layer on hold, but send left paren on press if (record->tap.count && record->event.pressed) { - tap_code16(KC_LPRN); - return false; + tap_code16(KC_LPRN); + return false; } break; case LT(_NUMS,KC_RPRN): // Shift to _NUMS on hold, send right parens on press if (record->tap.count && record->event.pressed) { - tap_code16(KC_RPRN); - return false; + tap_code16(KC_RPRN); + return false; } break; @@ -203,20 +203,20 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { if (record->tap.count && record->event.pressed) { tap_code16(SHOW_WINDOWS); // Intercept tap function } else if (record->event.pressed) { - tap_code16(WINDOW_LEFT); // Intercept hold function + tap_code16(WINDOW_LEFT); // Intercept hold function } return false; break; - + case LT(0, NUMERIC_WIN_RIGHT): if (record->tap.count && record->event.pressed) { layer_on(_NUM_MASK);// Intercept tap function } else if (record->event.pressed) { - tap_code16(WINDOW_RIGHT); // Intercept hold function + tap_code16(WINDOW_RIGHT); // Intercept hold function } return false; break; - + case PASTE_VIM: if (record->event.pressed){ SEND_STRING(SS_TAP(X_ESCAPE)"\"+pi"); @@ -225,7 +225,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { break; //only read the keymap config if it's one of the below cases (instead of every time) - case DEL_WORD: + case DEL_WORD: case SELECT_LEFT_WD: case SELECT_RIGHT_WD: case SELECT_LEFT_LINE: @@ -235,7 +235,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { case MOVE_LEFT_LINE: case MOVE_RIGHT_LINE: case PASTE_NOSTYLE: - case MOVE_BEGIN_LINE_TERMINAL: + case MOVE_BEGIN_LINE_TERMINAL: case MOVE_END_LINE_TERMINAL: case ACIRCLE: case ADOT: @@ -313,28 +313,28 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { if(keymap_config.swap_lctl_lgui){ //Linux tap_code16(LCTL(RSFT(KC_V))); } else { //osx - tap_code16(LGUI(LALT(LSFT(KC_V)))); + tap_code16(LGUI(LALT(LSFT(KC_V)))); } break; case MOVE_BEGIN_LINE_TERMINAL: if(keymap_config.swap_lctl_lgui){ //Linux tap_code16(KC_HOME); } else { //osx - tap_code16(LSFT(KC_HOME)); + tap_code16(LSFT(KC_HOME)); } break; case MOVE_END_LINE_TERMINAL: if(keymap_config.swap_lctl_lgui){ //Linux tap_code16(KC_END); } else { //osx - tap_code16(LSFT(KC_END)); + tap_code16(LSFT(KC_END)); } break; case ACIRCLE: // å if(keymap_config.swap_lctl_lgui){ //Linux SEND_STRING(SS_TAP(X_COMPOSE_KEY)"aa"); } else { //osx - tap_code16(LALT(KC_A)); + tap_code16(LALT(KC_A)); } break; case ADOT: // ä @@ -351,14 +351,14 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { SEND_STRING(SS_LALT("u")"o"); } break; - case COMPOSE_MACRO: + case COMPOSE_MACRO: if(keymap_config.swap_lctl_lgui){ //Linux tap_code16(COMPOSE_KEY); } else { //osx tap_code16(COMPOSE_MAC); } break; - case SCREENSHOT: + case SCREENSHOT: if(keymap_config.swap_lctl_lgui){ //Linux tap_code16(KC_PSCR); } else { //osx @@ -381,7 +381,7 @@ void dance_left_finished (tap_dance_state_t *state, void *user_data) { if(keymap_config.swap_lctl_lgui){ //Linux tap_code16(KC_HOME); } else { //osx - tap_code16(LGUI(KC_LEFT)); + tap_code16(LGUI(KC_LEFT)); } } else { //2 taps, make a circumflex tap_code16(KC_CIRC); @@ -394,7 +394,7 @@ void dance_right_finished (tap_dance_state_t *state, void *user_data) { if(keymap_config.swap_lctl_lgui){ //Linux tap_code16(KC_END); } else { //osx - tap_code16(LGUI(KC_RIGHT)); + tap_code16(LGUI(KC_RIGHT)); } } else { //2 taps, dollar tap_code16(KC_DOLLAR); @@ -429,7 +429,7 @@ void set_lighting_user(void) { led_t led_state = host_keyboard_led_state(); if(led_state.caps_lock){ rgblight_sethsv_noeeprom(HSV_RED); - } + } //rgblight_sethsv(HSV_OFF); break; case _NUMS: @@ -482,7 +482,7 @@ void oled_render_general_state(void){ else { oled_write_ln_P(PSTR("OSX"), false); } - + //oled_write_ln(get_u8_str(get_current_wpm(), '0'), false); /* led_t led_state = host_keyboard_led_state(); @@ -492,7 +492,7 @@ void oled_render_general_state(void){ //Layer color has to be handled by master - // led state doesn't have to be handled by master, but + // led state doesn't have to be handled by master, but // the keyboard will freeze if you type too fast // and have this handled on the slave side @@ -541,7 +541,7 @@ void oled_render_layer_mod_state(void) { break; case _FN_KEYS: oled_write_ln_P(PSTR("Fn"), false); - break; + break; default: break; } @@ -575,7 +575,7 @@ void oled_render_layer_mod_state(void) { bool oled_task_user(void) { if (is_keyboard_master()) { oled_render_general_state(); - } + } else { oled_render_layer_mod_state(); } diff --git a/keyboards/crkbd/keymaps/pdl/config.h b/keyboards/crkbd/keymaps/pdl/config.h index b25d48de02..f2a5a522ea 100644 --- a/keyboards/crkbd/keymaps/pdl/config.h +++ b/keyboards/crkbd/keymaps/pdl/config.h @@ -26,5 +26,4 @@ along with this program. If not, see . #define TAPPING_TERM 200 #define COMBO_PDL -#define COMBO_COUNT 28 #define COMBO_TERM 100 -- cgit v1.2.3