stasmarkin / sm_td

SM Tap Dance user library for QMK
GNU General Public License v3.0
138 stars 5 forks source link

Caps Word not working after my CKC_SPACE #23

Open fast-90 opened 4 weeks ago

fast-90 commented 4 weeks ago

I have SMTD_LT(CKC_SPACE, KC_SPACE, 6, 1) in my keymap, but for some reason my Caps Word is not working as expected: it keeps typing in Caps even if I type SPC. As soon as I replace CKC_SPACE with KC_SPACE it works as expected.

Any ideas what I could be doing wrong? Happy to provide more info if required!

azzamsa commented 3 weeks ago

I thought it was my config, I have a similar issue.

//
// shift functions
const key_override_t capsword_key_override = ko_make_basic(MOD_MASK_SHIFT, CW_TOGG, KC_CAPS);

const key_override_t *key_overrides[] = {
    &capsword_key_override
};
stasmarkin commented 3 weeks ago

Sorry, I don't use caps_lock much, so I don't really understand the desired behavior. Could you please specify what exactly happens when you press CKC_SPACE and what should happen instead?

azzamsa commented 3 weeks ago

Caps Word automatically disables itself at the end of the word. That is, it stops by default once a space or any key other than KC_A--KC_Z, KC_0--KC_9, KC_MINS, KC_UNDS, KC_DELETE, or KC_BACKSPACE is pressed. Caps Word also disables itself if the keyboard is idle for 5 seconds. This is configurable, see below.

According to the docs https://docs.qmk.fm/features/caps_word, caps word should automatically disabled by qmk after space. This is not the case when using sm_td.

stasmarkin commented 3 weeks ago

So the simplest solution here is to add CKC_SPACE to the bool caps_word_press_user(uint16_t keycode) function of the caps_word feature. Downside of this is that caps word will turn off even if you hold CKC_SPACE to switch to 6th layer.

If this doesn't suit you, here is a code you should use instead of SMTD_LT(CKC_SPACE, KC_SPACE, 6, 1):

case CKC_SPACE: {
    switch (action) {
        case SMTD_ACTION_TOUCH: 
            break;
        case SMTD_ACTION_TAP:
            caps_word_off();
            tap_code16(KC_SPACE);
            break;
        case SMTD_ACTION_HOLD:
            if (tap_count < 1) {
                LAYER_PUSH(6);
            } else {
                register_code16(KC_SPACE);
            }
            break;
        case SMTD_ACTION_RELEASE:
            if (tap_count < 1) {
                LAYER_RESTORE();
            }
            unregister_code16(KC_SPACE);
            break;
    }
    break;
}

So, on tapping it will disable caps_word, but holding will not.

stasmarkin commented 3 weeks ago

That workaround, but that's the best I can offer right now. I put this to backlog to support that natively

azzamsa commented 3 weeks ago

I put this to backlog to support that natively

I will use the sm_td as is for now, as I can cancel the caps_word using ,. Thanks a lot for maintaining sm_td 🥞