aboutsummaryrefslogtreecommitdiff
path: root/qmk
diff options
context:
space:
mode:
authorSébastien Dailly <sebastien@dailly.me>2026-02-20 14:18:41 +0100
committerSébastien Dailly <sebastien@dailly.me>2026-02-20 14:18:41 +0100
commitf58ef1bbd61ecc9f805fa6b71ee2d81db49ee428 (patch)
tree9f083862ead17f374ad33e113e20e7497169460b /qmk
parenta5fcbaff3fa2080b4c22d2be7e2c01c58758ea1c (diff)
Updated the behavior of the RSHIFT key
Diffstat (limited to 'qmk')
-rw-r--r--qmk/keyboards/sofle_choc/keymaps/custom/shift_dance.c21
1 files changed, 9 insertions, 12 deletions
diff --git a/qmk/keyboards/sofle_choc/keymaps/custom/shift_dance.c b/qmk/keyboards/sofle_choc/keymaps/custom/shift_dance.c
index 403c3df..ba2c9b5 100644
--- a/qmk/keyboards/sofle_choc/keymaps/custom/shift_dance.c
+++ b/qmk/keyboards/sofle_choc/keymaps/custom/shift_dance.c
@@ -3,11 +3,12 @@
#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.
+// The main usage is to activate the SHIFT mode when pressed. But when the key
+// is pressed without any other action, actives CAPS LOCK.
//
+// The key has to be released before the end of the dance period, if the key is
+// maintained for too long, only the SHIFT is applied.
+
static td_tap_t right_shift_tap_state = {
.state = TD_NONE
};
@@ -20,7 +21,7 @@ static bool lshift_interrupted = 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
+// This function is a callback called from process_record_user
void shift_dance_process_record(uint16_t keycode, keyrecord_t *record) {
if (right_shift_tap_state.state == TD_SINGLE_HOLD && record->event.pressed) {
// If there is any key pressed while holding the key, do not switch
@@ -71,14 +72,10 @@ void right_shift_released(tap_dance_state_t *state, void *user_data) {
// 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, switch into CAPS LOCK
- del_mods(MOD_MASK_SHIFT);
+ else if (!state->interrupted && !state->finished && !inhibit_mod)
+ // The key was released before the timeout, and no other key were
+ // pressed during this time
tap_code16(KC_CAPS_LOCK);
- }
inhibit_mod = 0;
}