stasmarkin / sm_td

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

is sm_td compatible with the update_tri_layer_state? #25

Open AnyRoad opened 2 months ago

AnyRoad commented 2 months ago

Hi, thanks for the great home row mods implementation!

Just tried it and everything works fine except the Tri Layers: https://docs.qmk.fm/ref_functions#update-tri-layer-state-state-x-y-z

Same config works with accordion but does not work with sm_td.

//**************** tri-state layer *********************//
// 
layer_state_t layer_state_set_user(layer_state_t state) {
   return update_tri_layer_state(state, CONTROLS, INTELLIJ, EXTRAS);
}

I don't know much about QMK internals but it seems like SMTD_LT activates target layer and turns others off, right? (like TO) That's might be the reaason why we cannot use tri state layers

#define LAYER_PUSH(layer)                              \
    return_layer_cnt++;                                \
    if (return_layer == RETURN_LAYER_NOT_SET) {        \
        return_layer = get_highest_layer(layer_state); \
    }                                                  \
    layer_move(layer);

#define LAYER_RESTORE()                          \
    if (return_layer_cnt > 0) {                  \
        return_layer_cnt--;                      \
        if (return_layer_cnt == 0) {             \
            layer_move(return_layer);            \
            return_layer = RETURN_LAYER_NOT_SET; \
        }                                        \
    }

Do you think it is possible to modify the implementation to make it work with the Tri State Layers?

AnyRoad commented 2 months ago

https://github.com/stasmarkin/sm_td/issues/21#issuecomment-2351654947

So all custom functions with layer switching won't work here.

Seems like it applies to the Tri State Layers as well :(

stasmarkin commented 2 months ago

Yep, tri-layers are not supported. Added this to a backlog. Tbh it's not first priority feature right now, but in a version or two I will implement this.

AnyRoad commented 2 months ago

Thank you! 😄