aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--qmk/keyboards/sofle_choc/keymaps/custom/enter_dance.c60
-rw-r--r--qmk/keyboards/sofle_choc/keymaps/custom/enter_dance.h8
-rw-r--r--qmk/keyboards/sofle_choc/keymaps/custom/keycodes.c17
-rw-r--r--qmk/keyboards/sofle_choc/keymaps/custom/keycodes.h7
-rw-r--r--qmk/keyboards/sofle_choc/keymaps/custom/keymap.c11
-rw-r--r--qmk/keyboards/sofle_choc/keymaps/custom/lighting.c9
-rw-r--r--qmk/keyboards/sofle_choc/keymaps/custom/lighting.h3
-rw-r--r--qmk/keyboards/sofle_choc/keymaps/custom/overrides.c21
-rw-r--r--qmk/keyboards/sofle_choc/keymaps/custom/overrides.h17
-rw-r--r--qmk/keyboards/sofle_choc/keymaps/custom/quad_tapdance.c66
-rw-r--r--qmk/keyboards/sofle_choc/keymaps/custom/quad_tapdance.h7
-rw-r--r--qmk/keyboards/sofle_choc/keymaps/custom/rules.mk8
-rw-r--r--qmk/keyboards/sofle_choc/keymaps/custom/shift_dance.c114
-rw-r--r--qmk/keyboards/sofle_choc/keymaps/custom/shift_dance.h13
14 files changed, 245 insertions, 116 deletions
diff --git a/qmk/keyboards/sofle_choc/keymaps/custom/enter_dance.c b/qmk/keyboards/sofle_choc/keymaps/custom/enter_dance.c
new file mode 100644
index 0000000..d5e0838
--- /dev/null
+++ b/qmk/keyboards/sofle_choc/keymaps/custom/enter_dance.c
@@ -0,0 +1,60 @@
+#include QMK_KEYBOARD_H
+#include "quad_tapdance.h"
+#include "enter_dance.h"
+
+static td_tap_t enter_tap_state = {
+ .state = TD_NONE
+};
+
+static bool inhibit_mod = 0;
+
+void enter_dance_process_record(uint16_t keycode, keyrecord_t *record) {
+ if (enter_tap_state.state == TD_SINGLE_HOLD && record->event.pressed) {
+ inhibit_mod = 1;
+ }
+ return;
+}
+
+void enter_finished(tap_dance_state_t *state, void *user_data) {
+ enter_tap_state.state = cur_dance(state);
+ switch (enter_tap_state.state) {
+ case TD_SINGLE_HOLD:
+ if (get_oneshot_mods() & MOD_MASK_ALT) {
+ del_oneshot_mods(MOD_MASK_ALT);
+ //clear_oneshot_mods();
+ inhibit_mod = 1;
+ }
+ register_code(KC_RIGHT_ALT);
+ break;
+ default: break;
+ }
+}
+
+void enter_released(tap_dance_state_t *state, void *user_data) {
+ if (state->finished && state->count > 1)
+ // Exit prevently, we are sure in the next conditions we don’t fall in
+ // this case.
+ return;
+ else if (!state->finished) {
+ tap_code16(KC_ENTER);
+ reset_tap_dance(state);
+ } else if (!state->interrupted) {
+ // Final case, the key was keeped pressed without any other action
+ // in this case, active the one shot key for right alt
+ if (get_oneshot_mods() & MOD_MASK_ALT) {
+ del_oneshot_mods(MOD_MASK_ALT);
+ //clear_oneshot_mods();
+ } else if (!inhibit_mod) {
+ set_oneshot_mods(MOD_BIT(KC_RIGHT_ALT));
+ }
+ }
+ inhibit_mod = 0;
+}
+
+void enter_reset(tap_dance_state_t *state, void *user_data) {
+ switch (enter_tap_state.state) {
+ case TD_SINGLE_HOLD: unregister_code(KC_RIGHT_ALT); break;
+ default: break;
+ }
+ enter_tap_state.state = TD_NONE;
+}
diff --git a/qmk/keyboards/sofle_choc/keymaps/custom/enter_dance.h b/qmk/keyboards/sofle_choc/keymaps/custom/enter_dance.h
new file mode 100644
index 0000000..382e28d
--- /dev/null
+++ b/qmk/keyboards/sofle_choc/keymaps/custom/enter_dance.h
@@ -0,0 +1,8 @@
+#pragma once
+#include QMK_KEYBOARD_H
+
+void enter_released(tap_dance_state_t *state, void *user_data);
+void enter_finished(tap_dance_state_t *state, void *user_data);
+void enter_reset(tap_dance_state_t *state, void *user_data);
+
+void enter_dance_process_record(uint16_t keycode, keyrecord_t *record);
diff --git a/qmk/keyboards/sofle_choc/keymaps/custom/keycodes.c b/qmk/keyboards/sofle_choc/keymaps/custom/keycodes.c
index 63bb76d..8819917 100644
--- a/qmk/keyboards/sofle_choc/keymaps/custom/keycodes.c
+++ b/qmk/keyboards/sofle_choc/keymaps/custom/keycodes.c
@@ -3,6 +3,8 @@
#include "keycodes.h"
#include "star_key.h"
#include "lighting.h"
+#include "enter_dance.h"
+#include "shift_dance.h"
void keyboard_post_init_user(void) {
lighting_init();
@@ -16,6 +18,10 @@ void housekeeping_task_user(void) {
housekeeping_task_lighting();
}
+void oneshot_mods_changed_user(uint8_t mods) {
+ oneshot_mods_changed_lighting(mods);
+}
+
/*
* Rules and modifier to apply over the keycodes. This includes the keys
* redefinitions and the keys to include in the caps_word mecanism.
@@ -34,7 +40,6 @@ bool caps_word_press_user(uint16_t keycode) {
case KC_A ... KC_Z:
case KC_1 ... KC_0:
case KC_MINS:
- case KEY_C: // Add also the tapdance keys here.
case KEY_W:
case KEY_E:
case BP_Z: // Additionals keys from the bepo layout.
@@ -65,9 +70,8 @@ uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record) {
case KEY_E:
return 230;
case KEY_W:
- return 400;
- case KEY_EE:
- return 350;
+ case TD_ENTER:
+ return 2 * TAPPING_TERM;
default:
return TAPPING_TERM;
}
@@ -88,8 +92,10 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
latest_key = keycode;
}
- // Call the star_key handler
+ // Call the callback handlers
star_key_process_record(keycode, record);
+ shift_dance_process_record(keycode, record);
+ enter_dance_process_record(keycode, record);
switch (keycode) {
case KC_LEFT_SHIFT:
@@ -97,6 +103,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
tap_code16(KC_CAPS_LOCK);
}
return true;
+ case KC_ESC:
case AL_ENT:
if (layer_state_is(LAYER_SYMBOLS) && !record->event.pressed) {
// Remove the layer the key is released.
diff --git a/qmk/keyboards/sofle_choc/keymaps/custom/keycodes.h b/qmk/keyboards/sofle_choc/keymaps/custom/keycodes.h
index 8ae3fc1..d75d5d9 100644
--- a/qmk/keyboards/sofle_choc/keymaps/custom/keycodes.h
+++ b/qmk/keyboards/sofle_choc/keymaps/custom/keycodes.h
@@ -1,15 +1,13 @@
#pragma once
enum {
- // Custom key for defining the tapdance allowing to transform C into Ç
- TD_C_CCED,
// Transform the key W into SHIFT or CAPSLOCK
TD_W_CAPSLOCK,
// Transform the key E into È
TD_EE,
TD_PRC,
TD_LAYER_SYMB,
- TD_LSFT,
+ TD_ENTER,
};
enum {
@@ -20,12 +18,11 @@ 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 AL_ENT MT(MOD_RALT, KC_ENT)
#define AL_SPC MT(MOD_LALT, KC_SPC)
#define KEY_E MT(MOD_LCTL, BP_E)
-#define KEY_EE TD(TD_EE)
#define KEY_T MT(MOD_RCTL, BP_T)
#define KEY_INS MT(MOD_RGUI, KC_INS)
+#define TD_ENTR TD(TD_ENTER)
diff --git a/qmk/keyboards/sofle_choc/keymaps/custom/keymap.c b/qmk/keyboards/sofle_choc/keymaps/custom/keymap.c
index 4c9dc13..fcea429 100644
--- a/qmk/keyboards/sofle_choc/keymaps/custom/keymap.c
+++ b/qmk/keyboards/sofle_choc/keymaps/custom/keymap.c
@@ -21,23 +21,26 @@
#include "keymap_bepo.h"
#include "keycodes.h"
#include "quad_tapdance.h"
+#include "enter_dance.h"
+#include "shift_dance.h"
#include "overrides.h"
#include QMK_KEYBOARD_H
// Declare the tapdance table here.
// The functions for ACTION_TAP_DANCE_FN_ADVANCED or defined in "quand_dance"
tap_dance_action_t tap_dance_actions[] = {
- [TD_C_CCED] = ACTION_TAP_DANCE_DOUBLE(BP_C, BP_CCED),
[TD_PRC] = ACTION_TAP_DANCE_DOUBLE(BP_EQL, BP_PERC),
- [TD_W_CAPSLOCK] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, w_finished, w_reset),
+ [TD_W_CAPSLOCK] = ACTION_TAP_DANCE_FN_ADVANCED_WITH_RELEASE(NULL, w_released, w_finished, w_reset),
[TD_LAYER_SYMB] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, ql_finished, ql_reset),
[TD_EE] = ACTION_TAP_DANCE_DOUBLE(BP_COMM, BP_EGRV),
+ [TD_ENTER] = ACTION_TAP_DANCE_FN_ADVANCED_WITH_RELEASE(NULL, enter_released, enter_finished, enter_reset),
};
#define LY_SYMB TD(TD_LAYER_SYMB)
-#define LY_DIACRITIC MO(LAYER_DIACRITIC)
+// Activate the layer just for a single key
+#define LY_DIACRITIC OSL(LAYER_DIACRITIC)
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
@@ -62,7 +65,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
BP_DLR, BP_B, BP_EACU, BP_P, BP_O, BP_EGRV, BP_DCIR, BP_V, BP_D, KC_O, BP_J, BP_Z,
KC_TAB, BP_A, BP_U, BP_I, KEY_E, BP_COMM, BP_C, KEY_T, BP_S, BP_R, BP_N, BP_M,
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_SYMB, AL_SPC, AL_ENT, LY_SYMB, KEY_APP, KEY_INS, LY_DIACRITIC
+ KC_LCTL, KC_DELETE,KC_LGUI,LY_SYMB, AL_SPC, TD_ENTR,LY_SYMB, KEY_APP, KEY_INS, LY_DIACRITIC
),
// In the number layout, I keep the mod-tap modifiers applies to the middle letters :
diff --git a/qmk/keyboards/sofle_choc/keymaps/custom/lighting.c b/qmk/keyboards/sofle_choc/keymaps/custom/lighting.c
index 525d0c4..9e4001d 100644
--- a/qmk/keyboards/sofle_choc/keymaps/custom/lighting.c
+++ b/qmk/keyboards/sofle_choc/keymaps/custom/lighting.c
@@ -25,6 +25,11 @@ void lighting_init(void) {
static uint8_t last_flags;
+static bool one_shot_alt_flag = 0;
+
+void oneshot_mods_changed_lighting(uint8_t mods) {
+ one_shot_alt_flag = mods & MOD_MASK_ALT;
+}
void housekeeping_task_lighting(void) {
@@ -46,11 +51,11 @@ void housekeeping_task_lighting(void) {
flags |= 0b001;
counter += 1;
}
- if (get_mods() & MOD_MASK_ALT) {
+ if (one_shot_alt_flag || (get_mods() & MOD_MASK_ALT)) {
flags |= 0b010;
counter += 1;
}
- if (get_mods() & MOD_MASK_SHIFT) {
+ if ((get_mods() & MOD_MASK_SHIFT) || host_keyboard_led_state().caps_lock) {
flags |= 0b100;
counter += 1;
}
diff --git a/qmk/keyboards/sofle_choc/keymaps/custom/lighting.h b/qmk/keyboards/sofle_choc/keymaps/custom/lighting.h
index b3bd615..a66e329 100644
--- a/qmk/keyboards/sofle_choc/keymaps/custom/lighting.h
+++ b/qmk/keyboards/sofle_choc/keymaps/custom/lighting.h
@@ -1,5 +1,8 @@
#pragma once
+// Callback for one_shot_modifier
+void oneshot_mods_changed_lighting(uint8_t mods);
+
void lighting_init(void);
void housekeeping_task_lighting(void);
diff --git a/qmk/keyboards/sofle_choc/keymaps/custom/overrides.c b/qmk/keyboards/sofle_choc/keymaps/custom/overrides.c
index 3875215..0181903 100644
--- a/qmk/keyboards/sofle_choc/keymaps/custom/overrides.c
+++ b/qmk/keyboards/sofle_choc/keymaps/custom/overrides.c
@@ -6,25 +6,8 @@
// Override the symbol ° and replace it by `
// The symbol is still available in the symbol layer with the key just below.
//
-const key_override_t perc_key_override =
+const key_override_t perc_key_override =
ko_make_basic(MOD_MASK_SHIFT, KEY_PRC, LSFT(BP_PERC));
-//
-// I don’t care of the mapping CTRL+Ç and using the mod_tap does not work well
-// when I type too fast because of tap-dance, so I remap the pattern here.
-//
-const key_override_t c_key_override =
- ko_make_basic(MOD_MASK_CTRL, KEY_C, LCTL(BP_C));
-
-// Same here, I want to be able to type '' without triggering the tapdance.
-// And there is no such key combo for Alt+È.
-const key_override_t quote_key_override =
- ko_make_basic(MOD_MASK_ALT, KEY_EE, RALT(BP_COMM));
-
-// Same here, I override the key W with CTRL because the tapdance activate the
-// caps_word which does not make sense here.
-const key_override_t w_key_override =
- ko_make_basic(MOD_MASK_CTRL, KEY_W, LCTL(BP_W));
-
-const key_override_t e_key_override =
+const key_override_t e_key_override =
ko_make_basic(MOD_MASK_CTRL, KEY_E, RCTL(BP_E));
diff --git a/qmk/keyboards/sofle_choc/keymaps/custom/overrides.h b/qmk/keyboards/sofle_choc/keymaps/custom/overrides.h
index c531a12..45c723c 100644
--- a/qmk/keyboards/sofle_choc/keymaps/custom/overrides.h
+++ b/qmk/keyboards/sofle_choc/keymaps/custom/overrides.h
@@ -9,29 +9,20 @@
//
const key_override_t perc_key_override ;
-//
+//
// I don’t care of the mapping CTRL+Ç and using the mod_tap does not work well
// when I type too fast because of tap-dance, so I remap the pattern here.
//
-const key_override_t c_key_override ;
-
-// Same here, I want to be able to type '' without triggering the tapdance.
-// And there is no such key combo for Alt+È.
-const key_override_t quote_key_override ;
-
-// Same here, I override the key W with CTRL because the tapdance activate the
-// caps_word which does not make sense here.
-const key_override_t w_key_override ;
+//const key_override_t c_key_override ;
const key_override_t e_key_override ;
// This globally defines all key overrides to be used
const key_override_t *key_overrides[]= (const key_override_t *[]){
&perc_key_override,
- &c_key_override,
- &w_key_override,
&e_key_override,
- &quote_key_override,
+ &shift_space_override,
+ //&shift_o_override,
// Override the key GUI + MENU and to map the key desktop from the
// typematrix
&(ko_make_basic(MOD_MASK_GUI, KEY_APP, MENU)),
diff --git a/qmk/keyboards/sofle_choc/keymaps/custom/quad_tapdance.c b/qmk/keyboards/sofle_choc/keymaps/custom/quad_tapdance.c
index 8c1e4e9..65e4e01 100644
--- a/qmk/keyboards/sofle_choc/keymaps/custom/quad_tapdance.c
+++ b/qmk/keyboards/sofle_choc/keymaps/custom/quad_tapdance.c
@@ -40,75 +40,22 @@ td_state_t cur_dance(tap_dance_state_t *state) {
// key is still pressed.
//
if (!state->pressed) return TD_SINGLE_TAP;
- // Key has not been interrupted, but the key is still held. Means you want to send a 'HOLD'.
+ // Key has not been interrupted, but the key is still held.
+ // Means you want to send a 'HOLD'.
else return TD_SINGLE_HOLD;
} else if (state->count == 2) {
- // TD_DOUBLE_SINGLE_TAP is to distinguish between typing "pepper", and actually wanting a double tap
- // action when hitting 'pp'. Suggested use case for this return value is when you want to send two
+ // TD_DOUBLE_SINGLE_TAP is to distinguish between typing "pepper",
+ // and actually wanting a double tap
+ // action when hitting 'pp'. Suggested use case for this return value
+ // is when you want to send two
// keystrokes of the key, and not the 'double tap' action/macro.
if (state->interrupted) return TD_DOUBLE_SINGLE_TAP;
else if (state->pressed) return TD_DOUBLE_HOLD;
else return TD_DOUBLE_TAP;
- }
-
- // Assumes no one is trying to type the same letter three times (at least not quickly).
- // If your tap dance key is 'KC_W', and you want to type "www." quickly - then you will need to add
- // an exception here to return a 'TD_TRIPLE_SINGLE_TAP', and define that enum just like 'TD_DOUBLE_SINGLE_TAP'
- if (state->count == 3) {
- if (state->interrupted || !state->pressed) return TD_TRIPLE_TAP;
- else return TD_TRIPLE_HOLD;
} else return TD_UNKNOWN;
}
//
-// Definition for the key W.
-//
-// The main usage is to send the letter W when pressed, but the key is also
-// used to activate the SHIFT mode when pressed.
-//
-// If the key is double tapped, it will also switch into the caps_word mode.
-//
-
-static td_tap_t w_tap_state = {
- .is_press_action = true,
- .state = TD_NONE
-};
-
-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_DOUBLE_TAP:
- caps_word_on();
- break;
- case TD_DOUBLE_SINGLE_TAP:
- register_code(BP_W);
- register_code(BP_W);
- break;
- case TD_SINGLE_HOLD:
- case TD_DOUBLE_HOLD:
- caps_word_off();
- register_code(KC_RIGHT_SHIFT);
- break;
- default: break;
- }
-}
-
-void w_reset(tap_dance_state_t *state, void *user_data) {
- switch (w_tap_state.state) {
- case TD_SINGLE_TAP: unregister_code(BP_W); break;
- case TD_SINGLE_HOLD: unregister_code(KC_RIGHT_SHIFT); break;
- case TD_DOUBLE_SINGLE_TAP:
- unregister_code(BP_W);
- unregister_code(BP_W);
- break;
- default: break;
- }
- w_tap_state.state = TD_NONE;
-}
-
-//
// Definition for the layer key
//
// The only one usage is to activate the layer over the keyboard, but there is
@@ -120,7 +67,6 @@ void w_reset(tap_dance_state_t *state, void *user_data) {
// you can go back into the normal layer by a single press on the key.
//
static td_tap_t ql_tap_state = {
- .is_press_action = true,
.state = TD_NONE
};
diff --git a/qmk/keyboards/sofle_choc/keymaps/custom/quad_tapdance.h b/qmk/keyboards/sofle_choc/keymaps/custom/quad_tapdance.h
index 8d67282..8f2770c 100644
--- a/qmk/keyboards/sofle_choc/keymaps/custom/quad_tapdance.h
+++ b/qmk/keyboards/sofle_choc/keymaps/custom/quad_tapdance.h
@@ -11,20 +11,13 @@ typedef enum {
TD_DOUBLE_TAP,
TD_DOUBLE_HOLD,
TD_DOUBLE_SINGLE_TAP, // Send two single taps
- TD_TRIPLE_TAP,
- TD_TRIPLE_HOLD
} td_state_t;
typedef struct {
- bool is_press_action;
td_state_t state;
} td_tap_t;
td_state_t cur_dance(tap_dance_state_t *state);
-// For the x tap dance. Put it here so it can be used in any keymap
-void w_finished(tap_dance_state_t *state, void *user_data);
-void w_reset(tap_dance_state_t *state, void *user_data);
-
void ql_finished(tap_dance_state_t *state, void *user_data);
void ql_reset(tap_dance_state_t *state, void *user_data);
diff --git a/qmk/keyboards/sofle_choc/keymaps/custom/rules.mk b/qmk/keyboards/sofle_choc/keymaps/custom/rules.mk
index a573d5b..5cda5bd 100644
--- a/qmk/keyboards/sofle_choc/keymaps/custom/rules.mk
+++ b/qmk/keyboards/sofle_choc/keymaps/custom/rules.mk
@@ -11,4 +11,10 @@ RGB_MATRIX_DRIVER = ws2812
MOUSEKEY_ENABLE = yes
CONVERT_TO=rp2040_ce
-SRC += star_key.c quad_tapdance.c keycodes.c overrides.c lighting.c
+SRC += star_key.c \
+ quad_tapdance.c \
+ enter_dance.c \
+ shift_dance.c \
+ keycodes.c \
+ overrides.c \
+ lighting.c
diff --git a/qmk/keyboards/sofle_choc/keymaps/custom/shift_dance.c b/qmk/keyboards/sofle_choc/keymaps/custom/shift_dance.c
new file mode 100644
index 0000000..82448a4
--- /dev/null
+++ b/qmk/keyboards/sofle_choc/keymaps/custom/shift_dance.c
@@ -0,0 +1,114 @@
+#include QMK_KEYBOARD_H
+#include "keymap_bepo.h"
+#include "quad_tapdance.h"
+#include "shift_dance.h"
+//
+// Definition for the key W.
+//
+// The main usage is to send the letter W when pressed, but the key is also
+// used to activate the SHIFT mode when pressed.
+//
+static td_tap_t w_tap_state = {
+ .state = TD_NONE
+};
+
+// Do not switch the supended mode when the key is released.
+// This allow to remove the mod earler without reactivating automatically.
+static bool inhibit_mod = 0;
+
+// Flag telling if the suspended mode is active or not.
+static bool activated = 0;
+
+// If there is any other keypress before releasing the key, do not keep the
+// layer once the key is release.
+//
+// This function is a callbackk called from process_record_user
+void shift_dance_process_record(uint16_t keycode, keyrecord_t *record) {
+ if (w_tap_state.state == TD_SINGLE_HOLD && record->event.pressed) {
+ inhibit_mod = 1;
+ }
+ switch (keycode) {
+ case KC_LSFT:
+ activated = 0;
+ break;
+ // Leave the suspended mode on ESC
+ case KC_ESC:
+ if (activated) {
+ set_mods(get_mods() & (!MOD_MASK_SHIFT));
+ activated = 0;
+ }
+ break;
+ default:
+ break;
+ }
+ return;
+}
+
+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_HOLD:
+ caps_word_off();
+ if (get_mods() & MOD_MASK_SHIFT) {
+ del_mods(MOD_MASK_SHIFT);
+ inhibit_mod = 1;
+ }
+ register_code(KC_RIGHT_SHIFT);
+ break;
+ default: break;
+ }
+}
+
+void w_released(tap_dance_state_t *state, void *user_data) {
+ if (state->finished && state->count > 1)
+ // Exit prevently, we are sure in the next conditions we don’t fall in
+ // this case.
+ return;
+ else if (!state->finished)
+ tap_code16(BP_W);
+ else if (!state->interrupted && !inhibit_mod) {
+ // Final case, the key was keeped pressed without any other action
+ // in this case, inverse the Shift mode, and update the activation flag
+ set_mods(get_mods() ^ MOD_MASK_SHIFT);
+ activated = get_mods() & MOD_MASK_SHIFT;
+ }
+ inhibit_mod = 0;
+}
+
+void w_reset(tap_dance_state_t *state, void *user_data) {
+ switch (w_tap_state.state) {
+ case TD_SINGLE_HOLD:
+ unregister_code(KC_RIGHT_SHIFT);
+ break;
+ default: break;
+ }
+ w_tap_state.state = TD_NONE;
+}
+
+
+// Deactivate the shift mode for the space key when the suspended mode is
+// active. This allow to insert a normal space character instead of a
+// unbreakable space.
+const key_override_t shift_space_override =
+ {.trigger_mods = MOD_MASK_SHIFT,
+ .layers = ~0,
+ .suppressed_mods = MOD_MASK_SHIFT,
+ .options = ko_options_default,
+ .negative_mod_mask = (uint8_t)0,
+ .custom_action = NULL,
+ .context = NULL,
+ .trigger = AL_SPC,
+ .replacement = AL_SPC,
+ .enabled = &activated};
+
+const key_override_t shift_o_override =
+ {.trigger_mods = MOD_MASK_SHIFT,
+ .layers = ~0,
+ .suppressed_mods = MOD_MASK_SHIFT,
+ .options = ko_options_default,
+ .negative_mod_mask = (uint8_t)0,
+ .custom_action = NULL,
+ .context = NULL,
+ .trigger = KC_O,
+ .replacement = KC_O,
+ .enabled = &activated};
diff --git a/qmk/keyboards/sofle_choc/keymaps/custom/shift_dance.h b/qmk/keyboards/sofle_choc/keymaps/custom/shift_dance.h
new file mode 100644
index 0000000..8cff3fe
--- /dev/null
+++ b/qmk/keyboards/sofle_choc/keymaps/custom/shift_dance.h
@@ -0,0 +1,13 @@
+#pragma once
+#include QMK_KEYBOARD_H
+
+
+// For the x tap dance. Put it here so it can be used in any keymap
+void w_released(tap_dance_state_t *state, void *user_data);
+void w_finished(tap_dance_state_t *state, void *user_data);
+void w_reset(tap_dance_state_t *state, void *user_data);
+
+
+void shift_dance_process_record(uint16_t keycode, keyrecord_t *record);
+const key_override_t shift_space_override;
+const key_override_t shift_o_override;