diff --git a/keyboards/kyria/keymaps/slyces/keymap.c b/keyboards/kyria/keymaps/slyces/keymap.c index 7474532c66cf..d4312b4b3e8d 100644 --- a/keyboards/kyria/keymaps/slyces/keymap.c +++ b/keyboards/kyria/keymaps/slyces/keymap.c @@ -90,11 +90,16 @@ /* Re-pass though to allow templates to be used */ #define LAYOUT_kyria_custom_wrapper(...) LAYOUT_kyria_custom(__VA_ARGS__) +/* ───────────────────────────────────────── shortcuts ────────────────────────────────────────── */ +#define OS_SFT OSM(MOD_LSFT) + /* ───────────────────────────────────── Tap dance Shortcuts ───────────────────────────────────── */ #ifdef TAP_DANCE_ENABLE #define TD_M TD(TD_MOVE) + #define TD_A TD(TD_ALT) #else #define TD_M _______ + #define TD_A _______ #endif /* ─────────────────────────────────────── Thumb Clusters ──────────────────────────────────────── */ @@ -113,17 +118,13 @@ /* ,-------------. ,-------------. * |GAMING|CONFIG| |CONFIG|GAMING| * ,--------------------+------+------| |------+------+--------------------. - * | | | ESC | ENTR | i3 | | i3 | SPC | TAB | | | + * | | |OS_SFT| ENTR | i3 | | i3 | SPC |OS_SFT| | | * | | |[ALT] |[CTRL]| tmux | | tmux |[CTRL]| [ALT]| | | * `----------------------------------' `----------------------------------' */ #define _____________DEFAULT_THUMBS_CLUSTER____________ \ - DF(_GAMING), MO(_CONFIG), MO(_CONFIG), DF(_GAMING), \ - _______, _______, ALT_T(KC_ESC), CTL_T(KC_ENT), TD_M, TD_M, CTL_T(KC_SPC), ALT_T(KC_TAB), _______, _______ - - -/* ───────────────────────────────────────── shortcuts ────────────────────────────────────────── */ -#define OS_SFT OSM(MOD_LSFT) + DF(_GAMING), MO(_CONFIG), MO(_CONFIG), DF(_GAMING), \ + _______, _______, TD_A, CTL_T(KC_ENT), TD_M, TD_M, CTL_T(KC_SPC), TD_A, _______, _______ /* ─────────────────────────────────────────── layers ──────────────────────────────────────────── */ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { diff --git a/users/slyces/tap_dances.c b/users/slyces/tap_dances.c index 0c672635902e..05e2e868072e 100644 --- a/users/slyces/tap_dances.c +++ b/users/slyces/tap_dances.c @@ -51,7 +51,6 @@ uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record) { } /* ────────────────────────── tap dance functions ─────────────────────────── */ -// Functions that control what our tap dance key does void mv_finished(qk_tap_dance_state_t *state, void *user_data) { mv_state.state = cur_dance(state); switch (mv_state.state) { @@ -83,7 +82,8 @@ void mv_reset(qk_tap_dance_state_t *state, void *user_data) { mv_state.state = 0; } -// Functions that control what our tap dance key does +// -------------------------------- + void sft_finished(qk_tap_dance_state_t *state, void *user_data) { sft_state.state = cur_dance(state); switch (sft_state.state) { @@ -101,8 +101,36 @@ void sft_reset(qk_tap_dance_state_t *state, void *user_data) { sft_state.state = 0; } +// -------------------------------- + +void os_alt_finished(qk_tap_dance_state_t *state, void *user_data) { + mv_state.state = cur_dance(state); + switch (mv_state.state) { + case SINGLE_TAP: // 1 Tap → OSL(shift) + set_oneshot_mods(MOD_LSFT); + break; + case SINGLE_HOLD: // Hold → NUM + ALT + register_mods(MOD_BIT(KC_LALT)); + break; + } +} + +void os_alt_reset(qk_tap_dance_state_t *state, void *user_data) { + // If the key was held down and now is released then switch off the mod + switch (mv_state.state) { + case SINGLE_TAP: break; + case SINGLE_HOLD: + layer_off(_NUM); + unregister_mods(MOD_BIT(KC_LALT)); + break; + } + mv_state.state = 0; +} + +/* ────────────────────────────────────────────────────────────────────────── */ // Associate our tap dance key with its functionality qk_tap_dance_action_t tap_dance_actions[] = { [TD_MOVE] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, mv_finished, mv_reset), [TD_SCOL] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, sft_finished, sft_reset), + [TD_ALT] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, os_alt_finished, os_alt_reset), }; diff --git a/users/slyces/tap_dances.h b/users/slyces/tap_dances.h index fdff2f742003..9524224cdab4 100644 --- a/users/slyces/tap_dances.h +++ b/users/slyces/tap_dances.h @@ -32,7 +32,8 @@ typedef struct { /* -------------------------------- keycodes -------------------------------- */ enum td_keycodes { TD_MOVE, - TD_SCOL + TD_SCOL, + TD_ALT, }; @@ -45,5 +46,9 @@ void mv_reset(qk_tap_dance_state_t *state, void *user_data); void sft_finished(qk_tap_dance_state_t *state, void *user_data); void sft_reset(qk_tap_dance_state_t *state, void *user_data); +// alt + OSL(sft) +void os_alt_finished(qk_tap_dance_state_t *state, void *user_data); +void os_alt_reset(qk_tap_dance_state_t *state, void *user_data); + /* --------------------------------- utils ---------------------------------- */ uint8_t cur_dance(qk_tap_dance_state_t *state);