diff options
Diffstat (limited to 'qmk/keyboards/sofle_choc')
6 files changed, 58 insertions, 63 deletions
diff --git a/qmk/keyboards/sofle_choc/keymaps/custom/config.h b/qmk/keyboards/sofle_choc/keymaps/custom/config.h index 6463554..9473991 100644 --- a/qmk/keyboards/sofle_choc/keymaps/custom/config.h +++ b/qmk/keyboards/sofle_choc/keymaps/custom/config.h @@ -42,7 +42,7 @@ // the tap-dance before reporting the key to send. // If I release the MOD-TAP key before, the modifier is not applied and the // host receive a sequence of two keys, which is not what I want. -#define PERMISSIVE_HOLD +//#define PERMISSIVE_HOLD //#define HOLD_ON_OTHER_KEY_PRESS #define COMBO_MUST_PRESS_IN_ORDER diff --git a/qmk/keyboards/sofle_choc/keymaps/custom/keycodes.c b/qmk/keyboards/sofle_choc/keymaps/custom/keycodes.c index 761e653..d3cb716 100644 --- a/qmk/keyboards/sofle_choc/keymaps/custom/keycodes.c +++ b/qmk/keyboards/sofle_choc/keymaps/custom/keycodes.c @@ -50,8 +50,8 @@ uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record) { switch (keycode) { case KEY_E: return 230; - case LT_SFT: - return 250; + case KEY_W: + return 300; case KEY_EE: return 350; default: @@ -75,22 +75,33 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { } switch (keycode) { + case KC_LEFT_SHIFT: + if (host_keyboard_led_state().caps_lock) { + tap_code16(KC_CAPS_LOCK); + } + return true; case AL_ENT: if (layer_state_is(LAYER_SYMBOLS) && !record->event.pressed) { // Remove the layer the key is released. layer_clear(); } - return true; // Let QMK send the enter press/release events + return true; // If a key where released just before, consider we are typing some text // and not starting a new sequence case KEY_E: if (record->event.pressed && timer_elapsed32(key_timer) < TAPPING_TERM) { + if (is_caps_word_on()) { + add_oneshot_mods(MOD_MASK_SHIFT); + } register_code(BP_E); return false; } return true; case KEY_T: if (record->event.pressed && timer_elapsed32(key_timer) < TAPPING_TERM) { + if (is_caps_word_on()) { + add_oneshot_mods(MOD_MASK_SHIFT); + } register_code(BP_T); return false; } @@ -108,6 +119,27 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { return false; } return true; + + // Override the key APP when hold into AltGR + Layer 1 when hold + case KEY_APP: + if (!record->tap.count && record->event.pressed) { + layer_on(1); + register_code(KC_RIGHT_ALT); + return false; + } else if (!record->tap.count && !record->event.pressed) { + unregister_code(KC_RIGHT_ALT); + layer_off(1); + return false; + } + + case KC_LGUI: + if (record->event.pressed) { + layer_on(1); + } + else { + layer_off(1); + } + return true; default: return true; // Process all other keycodes normally } diff --git a/qmk/keyboards/sofle_choc/keymaps/custom/keycodes.h b/qmk/keyboards/sofle_choc/keymaps/custom/keycodes.h index b68fb34..9bf6290 100644 --- a/qmk/keyboards/sofle_choc/keymaps/custom/keycodes.h +++ b/qmk/keyboards/sofle_choc/keymaps/custom/keycodes.h @@ -19,10 +19,10 @@ enum { }; #define MENU LGUI(BP_I) +#define KEY_APP LT(0, KC_APP) #define KEY_C TD(TD_C_CCED) #define KEY_W TD(TD_W_CAPSLOCK) #define KEY_PRC TD(TD_PRC) -#define LT_SFT TD(TD_LSFT) #define AL_ENT MT(MOD_RALT, KC_ENT) #define AL_SPC MT(MOD_LALT, KC_SPC) #define KEY_E MT(MOD_LCTL, BP_E) diff --git a/qmk/keyboards/sofle_choc/keymaps/custom/keymap.c b/qmk/keyboards/sofle_choc/keymaps/custom/keymap.c index cd3da66..b02567e 100644 --- a/qmk/keyboards/sofle_choc/keymaps/custom/keymap.c +++ b/qmk/keyboards/sofle_choc/keymaps/custom/keymap.c @@ -42,8 +42,8 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KEY_PRC, BP_DLR, BP_B, BP_EACU, BP_P, BP_O, KC_BSPC, BP_DCIR, BP_V, BP_D, BP_L, BP_J, BP_Z, KC_TAB, BP_A, BP_U, BP_I, KEY_E, KEY_EE, KEY_C, KEY_T, BP_S, BP_R, BP_N, BP_M, - LT_SFT, BP_AGRV,BP_Y, BP_X, BP_DOT, KC_B, KC_MUTE, KC_MPLY,BP_QUOT, BP_Q, BP_G, BP_H, BP_F, KEY_W, - KC_LCTL, KC_DELETE,KC_LGUI,LY_SYMBOL,AL_SPC, AL_ENT, LY_SYMBOL,KC_APP, KEY_INS, KC_RCTL + KC_LSFT, BP_AGRV,BP_Y, BP_X, BP_DOT, KC_B, KC_MUTE, KC_MPLY,BP_QUOT, BP_Q, BP_G, BP_H, BP_F, KEY_W, + KC_LCTL, KC_DELETE,KC_LGUI,LY_SYMBOL,AL_SPC, AL_ENT, LY_SYMBOL,KEY_APP, KEY_INS, KC_RCTL ), // In the number layout, I keep the mod-tap modifiers applies to the middle letters : @@ -51,11 +51,12 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { #define KEY_5 MT(MOD_LCTL, KC_P5) #define KEY_DOWN MT(MOD_RCTL, KC_DOWN) +// This layer is used to access to the numeric keypad, functions keys, and also provide some keys used with KC_LGUI [LAYER_SYMBOLS] = LAYOUT( KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, - KC_NO, KC_NO, KC_P7, KC_P8, KC_P9, KC_TRNS, KC_HOME, KC_UP, KC_END, KC_NO, KC_NO, S(BP_EQL), - KC_TAB, KC_NO, KC_P4, KEY_5, KC_P6, KC_NO, KC_LEFT, KEY_DOWN, KC_RIGHT,KC_NO, KC_NO, KC_NO, - LT_SFT, KC_NO, KC_P1, KC_P2, KC_P3, KC_NO, KC_MUTE, KC_MPLY,KC_PGUP, KC_NO, KC_PGDN, KC_NO, KC_NO, KC_RIGHT_SHIFT, + KC_NO, KC_NO, KC_P7, KC_P8, KC_P9, KC_TRNS, KC_HOME, KC_UP, KC_END, KC_TRNS, KC_NO, S(BP_EQL), + KC_TAB, KC_NO, KC_P4, KEY_5, KC_P6, KC_NO, KC_LEFT, KEY_DOWN, KC_RIGHT,BP_R, BP_N, KC_PGUP, + KC_LSFT, KC_NO, KC_P1, KC_P2, KC_P3, KC_NO, KC_MUTE, KC_MPLY,KC_PGUP, KC_TRNS, KC_PGDN, KC_TRNS, BP_F, KC_PGDN, KC_P0, KC_PDOT, KC_TRNS, LY_SYMBOL,AL_SPC, AL_ENT, LY_SYMBOL,KC_TRNS, KC_RGUI, KC_TRNS ), }; diff --git a/qmk/keyboards/sofle_choc/keymaps/custom/overrides.c b/qmk/keyboards/sofle_choc/keymaps/custom/overrides.c index a64db44..a99582a 100644 --- a/qmk/keyboards/sofle_choc/keymaps/custom/overrides.c +++ b/qmk/keyboards/sofle_choc/keymaps/custom/overrides.c @@ -29,11 +29,6 @@ const key_override_t w_key_override = const key_override_t e_key_override = ko_make_basic(MOD_MASK_CTRL, KEY_E, RCTL(BP_E)); -// Override the key GUI + MENU and to map the key desktop from the typematrix -const key_override_t menu_key_override = - ko_make_basic(MOD_MASK_GUI, KC_APP, MENU); - - // This globally defines all key overrides to be used const key_override_t **key_overrides = (const key_override_t *[]){ &perc_key_override, @@ -41,6 +36,10 @@ const key_override_t **key_overrides = (const key_override_t *[]){ &w_key_override, &e_key_override, "e_key_override, - &menu_key_override, + // Override the key GUI + MENU and to map the key desktop from the + // typematrix + &(ko_make_basic(MOD_MASK_GUI, KEY_APP, MENU)), + + NULL }; diff --git a/qmk/keyboards/sofle_choc/keymaps/custom/quad_tapdance.c b/qmk/keyboards/sofle_choc/keymaps/custom/quad_tapdance.c index f0a5dbb..ab27f82 100644 --- a/qmk/keyboards/sofle_choc/keymaps/custom/quad_tapdance.c +++ b/qmk/keyboards/sofle_choc/keymaps/custom/quad_tapdance.c @@ -77,10 +77,16 @@ static td_tap_t w_tap_state = { void w_finished(tap_dance_state_t *state, void *user_data) { w_tap_state.state = cur_dance(state); switch (w_tap_state.state) { - case TD_SINGLE_TAP: register_code(BP_W); break; - case TD_SINGLE_HOLD: register_code(KC_RIGHT_SHIFT); break; - case TD_DOUBLE_TAP: caps_word_on(); break; - case TD_DOUBLE_SINGLE_TAP: tap_code(BP_W); register_code(BP_W); break; + case TD_SINGLE_TAP: + register_code(BP_W); break; + case TD_DOUBLE_TAP: + case TD_DOUBLE_SINGLE_TAP: + caps_word_on(); + break; + case TD_SINGLE_HOLD: + case TD_DOUBLE_HOLD: + register_code(KC_RIGHT_SHIFT); + break; default: break; } } @@ -132,48 +138,6 @@ void ql_reset(tap_dance_state_t *state, void *user_data) { } // -// Definiton for the key L_SHIFT. -// The main usage of the key is to activate the LShift when hold. But the key -// can also be used to active the CAPSLOCK mode. -// -// -static td_tap_t lshift_tap_state = { - .is_press_action = true, - .state = TD_NONE -}; - -// Functions that control what our tap dance key does -void lshift_finished(tap_dance_state_t *state, void *user_data) { - lshift_tap_state.state = cur_dance(state); - switch (lshift_tap_state.state) { - // Remove the layer with a single tap, this way I always have a key to remove the - // the layer, without knowing the previous state I had. - case TD_SINGLE_HOLD: - register_code(KC_LEFT_SHIFT); - break; - case TD_SINGLE_TAP: - if (host_keyboard_led_state().caps_lock) - register_code(KC_CAPS_LOCK); - break; - default: break; - } -} - -void lshift_reset(tap_dance_state_t *state, void *user_data) { - switch (lshift_tap_state.state) { - case TD_SINGLE_HOLD: - unregister_code(KC_LEFT_SHIFT); - break; - case TD_SINGLE_TAP: - if (host_keyboard_led_state().caps_lock) - unregister_code(KC_CAPS_LOCK); - break; - default: break; - } - lshift_tap_state.state = TD_NONE; -} - -// // Declare the tapdance table here. // tap_dance_action_t tap_dance_actions[] = { @@ -181,7 +145,6 @@ tap_dance_action_t tap_dance_actions[] = { [TD_PRC] = ACTION_TAP_DANCE_DOUBLE(BP_EQL, BP_PERC), [TD_W_CAPSLOCK] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, w_finished, w_reset), [TD_LAYER_SYMB] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, ql_finished, ql_reset), - [TD_LSFT] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, lshift_finished, lshift_reset), [TD_EE] = ACTION_TAP_DANCE_DOUBLE(BP_COMM, BP_EGRV), }; |