urob / zmk-config

Personal ZMK firmware configuration for various boards (34-keys, Corneish Zen, Planck)
526 stars 238 forks source link

star and fslh combo is not working #5

Closed chris-ryu closed 1 year ago

chris-ryu commented 1 year ago

The combo "star" and "flslh" does not work.

I am writing firmware for Ferris Sweep 34key based on your repository.

I copied and used the files like combos.dtsi, etc. and modified the base.keymap as follows.

I think it has something to do with the "RM2" key working up and down, but I can't find the exact reason.

Any help would be appreciated.

include

include <dt-bindings/zmk/keys.h>

if CONFIG_WIRELESS

#include <dt-bindings/zmk/bt.h>
#define _BT_SEL_KEYS_ &bt BT_SEL 0 &bt BT_SEL 1 &bt BT_SEL 2 &bt BT_SEL 3 &bt BT_CLR

else

#define _BT_SEL_KEYS_ &trans &trans &trans &trans &trans

endif

include "helper.h"

define DEF 0

define NAV 1

define FN 2

define NUM 3

define SYS 4

define UC 5

define MOUSE 6

include "combos.dtsi" // requires layer aliases

include "mouse.dtsi"

include "extra_keys.h"

define XXX &none

define ___ &trans

/ Global settings /

define QUICK_TAP_MS 175

&sk { // sticky-key config release-after-ms = <600>; // release after 0.6s quick-release; // no double capitalization when rolling keys };

&sl { // sticky-layer config ignore-modifiers; // allow chording sticky mods & layers };

&lt { // layer-tap config flavor = "balanced"; tapping-term-ms = <200>; quick-tap-ms = ; };

/ Homerow mods /

define KEYS_L LT0 LT1 LT2 LT3 LT4 LM0 LM1 LM2 LM3 LM4 LB0 LB1 LB2 LB3 LB4 // left hand

define KEYS_R RT0 RT1 RT2 RT3 RT4 RM0 RM1 RM2 RM3 RM4 RB0 RB1 RB2 RB3 RB4 // right hand

define THUMBS LH1 LH0 RH0 RH1 // thumbs

define MAKE_HRM(NAME, HOLD, TAP, TRIGGER_POS) \

ZMK_BEHAVIOR(NAME, hold_tap, \
    flavor = "balanced"; \
    tapping-term-ms = <280>; \
    quick-tap-ms = <QUICK_TAP_MS>; \
    global-quick-tap-ms = <150>; \
    bindings = <HOLD>, <TAP>; \
    hold-trigger-key-positions = <TRIGGER_POS>; \
    hold-trigger-on-release; \
)

MAKE_HRM(hml, &kp, &kp, KEYS_R THUMBS) // left-hand HRMs MAKE_HRM(hmr, &kp, &kp, KEYS_L THUMBS) // right-hand HRMs

MAKE_HRM(hml_repeat, &kp, &key_repeat, KEYS_R THUMBS) // used for HRM-combo MAKE_HRM(hmr_lpar_lt, &kp, &lpar_lt, KEYS_L THUMBS) // " " " " MAKE_HRM(hmr_rpar_gt, &kp, &rpar_gt, KEYS_L THUMBS) // " " " "

/ Nav cluster /

// long-tap action on hold, short-tap action on all interrupts

define MT_CORE \

flavor = "tap-preferred"; \
tapping-term-ms = <220>; \
quick-tap-ms = <220>; \
hold-trigger-key-positions = <0>;

&mt { MT_CORE }; ZMK_BEHAVIOR(mt_home, hold_tap, bindings = <&masked_home>, <&kp>; MT_CORE) ZMK_BEHAVIOR(mt_end, hold_tap, bindings = <&masked_end>, <&kp>; MT_CORE)

define NAV_LEFT &mt_home 0 LEFT // tap: left | long-tap: beginning of line

define NAV_RIGHT &mt_end 0 RIGHT // tap: right | long-tap: end of line

define NAV_UP &mt LC(HOME) UP // tap: up | long-tap: beginning of document

define NAV_DOWN &mt LC(END) DOWN // tap: down | long-tap: end of document

define NAV_BSPC &mt LC(BSPC) BSPC // tap: bspc | long-tap: delete word backward

define NAV_DEL &mt LC(DEL) DEL // tap: del | long-tap: delete word forward

// mask CTRL when holding left/right to avoid accidental jumps to beginning/end of document

define MASK_MODS(NAME, MODS, BINDING) \

ZMK_BEHAVIOR(NAME, mod_morph, \
    bindings = <BINDING>, <BINDING>; \
    mods = <MODS>; \
)

MASK_MODS(masked_home, (MOD_LCTL), &kp HOME) MASK_MODS(masked_end, (MOD_LCTL), &kp END)

/ Caps-word, num-word and smart-mouse /

// tap: sticky-shift | shift + tap/ double-tap: caps-word | hold: shift ZMK_BEHAVIOR(smart_shft, mod_morph, bindings = <&sk LSHFT>, <&caps_word>; mods = <(MOD_LSFT)>; ) &caps_word { // mods deactivate caps-word, requires PR #1441 /delete-property/ ignore-modifiers; };

// tap: num-word | double-tap: sticky num-layer | hold: num-layer

define SMART_NUM &smart_num NUM 0

ZMK_BEHAVIOR(smart_num, hold_tap, flavor = "balanced"; tapping-term-ms = <200>; quick-tap-ms = ; bindings = <&mo>, <&num_dance>; ) ZMK_BEHAVIOR(num_dance, tap_dance, tapping-term-ms = <200>; bindings = <&num_word>, <&sl NUM>; // reverse this for sticky-num on single tap ) &num_word { // num-word, requires PR #1441 layers = ; };

// smart-mouse, requires PR #1366 ZMK_BEHAVIOR(smart_mouse, tri_state, bindings = <&tog MOUSE>, <&none>, <&tog MOUSE>; ignored-key-positions = ; ignored-layers = ; )

/ Custom behaviors /

// Alt+Tab swapper, requires PR #1366 ZMK_BEHAVIOR(swapper, tri_state, bindings = <&kt LALT>, <&kp TAB>, <&kt LALT>; ignored-key-positions = ; )

// Sticky layer + sticky shift (workaround for issue #1421) ZMK_BEHAVIOR(sls, sticky_key, release-after-ms = <1000>; bindings = <&uc_shift>; ignore-modifiers; ) ZMK_BEHAVIOR(uc_shift, macro, wait-ms = <0>; tap-ms = <1>; bindings = <&macro_press &mo UC &kp LSHFT> , <&macro_pause_for_release> , <&macro_release &mo UC &kp LSHFT>; )

// tap: comma | shift + tap: semicolon | ctrl + shift + tap: < ZMK_BEHAVIOR(comma_morph, mod_morph, mods = <(MOD_LSFT|MOD_RSFT)>; bindings = <&kp COMMA>, <&comma_inner_morph>; ) ZMK_BEHAVIOR(comma_inner_morph, mod_morph, bindings = <&kp SEMICOLON>, <&kp LESS_THAN>; mods = <(MOD_LCTL|MOD_RCTL)>; )

// tap: dot | shift + tap: colon | ctrl + shift + tap: > ZMK_BEHAVIOR(dot_morph, mod_morph, bindings = <&kp DOT>, <&dot_inner_morph>; mods = <(MOD_LSFT|MOD_RSFT)>; ) ZMK_BEHAVIOR(dot_inner_morph, mod_morph, bindings = <&kp COLON>, <&kp GREATER_THAN>; mods = <(MOD_LCTL|MOD_RCTL)>; )

// tap: qmark | shift + tap: excl ZMK_BEHAVIOR(qexcl, mod_morph, bindings = <&kp QMARK>, <&kp EXCL>; mods = <(MOD_LSFT|MOD_RSFT)>; )

// tap: space | shift + tap: dot -> space -> sticky shift | hold: activate layer ZMK_BEHAVIOR(lt_spc, hold_tap, flavor = "balanced"; tapping-term-ms = <200>; quick-tap-ms = ; bindings = <&mo>, <&spc_morph>; ) ZMK_BEHAVIOR(spc_morph, mod_morph, bindings = <&kp SPACE>, <&dot_spc>; mods = <(MOD_LSFT|MOD_RSFT)>; ) ZMK_BEHAVIOR(dot_spc, macro, wait-ms = <0>; tap-ms = <5>; bindings = <&kp DOT &kp SPACE &sk LSHFT>; )

// tap: backspace | lshft + tap: delete | rshft + tap: shift-delete ZMK_BEHAVIOR(bs_del, mod_morph, bindings = <&kp BSPC>, <&kp DEL>; mods = <(MOD_LSFT|MOD_RSFT)>; keep-mods = ; )

// tap: left-parenthesis | shft + tap: less-than ZMK_BEHAVIOR(lpar_lt, mod_morph, bindings = <&kp LPAR>, <&kp LT>; mods = <(MOD_LSFT|MOD_RSFT)>; )

// tap: right-parenthesis | shft + tap: greater-than ZMK_BEHAVIOR(rpar_gt, mod_morph, bindings = <&kp RPAR>, <&kp GT>; mods = <(MOD_LSFT|MOD_RSFT)>; )

// tap: copy | double-tap: cut ZMK_BEHAVIOR(copy_cut, tap_dance, tapping-term-ms = <200>; bindings = <&kp LC(INS)>, <&kp LC(X)>; )

// Windows sleep key ZMK_BEHAVIOR(win_sleep, macro, wait-ms = <100>; tap-ms = <5>; bindings = <&kp LG(X) &kp U &kp S>; )

// misc aliases

define CANCEL &kp K_CANCEL // cancel caps-word, num-word and smart-mouse

define DSK_PREV &hmr RSHFT LG(LC(LEFT)) // previous desktop

define DSK_NEXT &hmr LALT LG(LC(RIGHT)) // next desktop

define VOL_DOWN &hmr LCTRL C_VOL_DN

/ Keymap /

ZMK_CONDITIONAL_LAYER(DEF NAV, MOUSE) // FN + NAV --> MOUSE ZMK_CONDITIONAL_LAYER(FN NUM, SYS) // FN + NUM --> SYS

ZMK_LAYER(base, //╭──────╮ ╭─────────────┬─────────────┬─────────────┬─────────────┬─────────────╮ ╭──────╮ ╭─────────────┬─────────────┬─────────────┬─────────────┬─────────────╮ ╭──────╮ X_LT &kp Q &kp W &kp E &kp R &kp T X_MT &kp Y &kp U &kp I &kp O &kp P X_RT //├──────┤ ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ ├──────┤ ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ ├──────┤ X_LM &hml LGUI A &hml LALT S &hml LCTRL D &hml LSHFT F &kp G X_MM &kp H &hmr RSHFT J &hmr LCTRL K &hmr LALT L &hmr LGUI SQT X_RM //├──────┤ ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ ├──────┤ ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ ├──────┤ X_LB &kp Z &kp X &kp C &kp V &kp B X_MB &kp N &kp M &comma_morph &dot_morph &qexcl X_RB //├──────┤ ╰─────────────┼─────────────┴─────────────┼─────────────┼─────────────┤ ├──────┤ ├─────────────┼─────────────┼─────────────┴───────────────────────────╯ ├──────┤ X_LH &lt_spc NAV 0 &lt FN RET X_MH SMART_NUM &smart_shft X_RH //╰──────╯ ╰─────────────┴─────────────╯ ╰──────╯ ╰─────────────┴─────────────╯ ╰──────╯ )

ZMK_LAYER(nav, //╭──────╮ ╭─────────────┬─────────────┬─────────────┬─────────────┬─────────────╮ ╭──────╮ ╭─────────────┬─────────────┬─────────────┬─────────────┬─────────────╮ ╭──────╮ X_LT &kp LS(TAB) &swapper _ X_MT &kp PG_UP NAV_BSPC NAV_UP NAV_DEL ___ X_RT //├──────┤ ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ ├──────┤ ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ ├──────┤ XLM &sk LGUI &sk LALT &sk LCTRL &sk LSHFT X_MM &kp PG_DN NAV_LEFT NAV_DOWN NAV_RIGHT &kp RET X_RM //├──────┤ ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ ├──────┤ ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ ├──────┤ X_LB _ X_MB &kp INS &kp TAB &kp LT &kp GT ___ X_RB //├──────┤ ╰─────────────┼─────────────┴─────────────┼─────────────┼─────────────┤ ├──────┤ ├─────────────┼─────────────┼─────────────┴───────────────────────────╯ ├──────┤ XLH _ XMH CANCEL X_RH //╰──────╯ ╰─────────────┴─────────────╯ ╰──────╯ ╰─────────────┴─────────────╯ ╰──────╯ )

ZMK_LAYER(fn, //╭──────╮ ╭─────────────┬─────────────┬─────────────┬─────────────┬─────────────╮ ╭──────╮ ╭─────────────┬─────────────┬─────────────┬─────────────┬─────────────╮ ╭──────╮ X_LT &kp F12 &kp F7 &kp F8 &kp F9 _ X_MT _ &kp C_PREV &kp C_VOL_UP &kp C_NEXT &win_sleep X_RT //├──────┤ ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ ├──────┤ ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ ├──────┤ XLM &kp F11 &kp F4 &kp F5 &kp F6 X_MM _ DSK_PREV VOL_DOWN DSKNEXT X_RM //├──────┤ ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ ├──────┤ ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ ├──────┤ XLB &kp F10 &kp F1 &kp F2 &kp F3 X_MB _ X_RB //├──────┤ ╰─────────────┼─────────────┴─────────────┼─────────────┼─────────────┤ ├──────┤ ├─────────────┼─────────────┼─────────────┴───────────────────────────╯ ├──────┤ XLH ___ X_MH &kp C_MUTE &kp C_PP X_RH //╰──────╯ ╰─────────────┴─────────────╯ ╰──────╯ ╰─────────────┴─────────────╯ ╰──────╯ )

ZMK_LAYER(num, //╭──────╮ ╭─────────────┬─────────────┬─────────────┬─────────────┬─────────────╮ ╭──────╮ ╭─────────────┬─────────────┬─────────────┬─────────────┬─────────────╮ ╭──────╮ X_LT &kp N7 &kp N8 &kp N9 X_MT _ X_RT //├──────┤ ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ ├──────┤ ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ ├──────┤ XLM &hml LGUI N0 &hml LALT N4 &hml LCTRL N5 &hml LSHFT N6 X_MM _ X_RM //├──────┤ ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ ├──────┤ ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ ├──────┤ XLB &kp N1 &kp N2 &kp N3 _ X_MB __ _ X_RB //├──────┤ ╰─────────────┼─────────────┴─────────────┼─────────────┼─────────────┤ ├──────┤ ├─────────────┼─────────────┼─────────────┴───────────────────────────╯ ├──────┤ XLH _ X_MH __ X_RH //╰──────╯ ╰─────────────┴─────────────╯ ╰──────╯ ╰─────────────┴─────────────╯ ╰──────╯ )

ZMK_LAYER(sys, //╭──────╮ ╭─────────────┬─────────────┬─────────────┬─────────────┬─────────────╮ ╭──────╮ ╭─────────────┬─────────────┬─────────────┬─────────────┬─────────────╮ ╭──────╮ X_LT _BT_SELKEYS X_MT _ X_RT //├──────┤ ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ ├──────┤ ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ ├──────┤ XLM _ &bootloader X_MM &bootloader __ X_RM //├──────┤ ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ ├──────┤ ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ ├──────┤ X_LB &sys_reset X_MB &sys_reset X_RB //├──────┤ ╰─────────────┼─────────────┴─────────────┼─────────────┼─────────────┤ ├──────┤ ├─────────────┼─────────────┼─────────────┴───────────────────────────╯ ├──────┤ X_LH X_MH X_RH //╰──────╯ ╰─────────────┴─────────────╯ ╰──────╯ ╰─────────────┴─────────────╯ ╰──────╯ )

ZMK_LAYER(mouse, //╭──────╮ ╭─────────────┬─────────────┬─────────────┬─────────────┬─────────────╮ ╭──────╮ ╭─────────────┬─────────────┬─────────────┬─────────────┬─────────────╮ ╭──────╮ X_LT _ X_MT ___ U_WH_D U_MS_U U_WHU X_RT //├──────┤ ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ ├──────┤ ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ ├──────┤ X_LM _ X_MM ___ U_MS_L U_MS_D U_MSR X_RM //├──────┤ ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ ├──────┤ ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ ├──────┤ X_LB _ X_MB __ _ X_RB //├──────┤ ╰─────────────┼─────────────┴─────────────┼─────────────┼─────────────┤ ├──────┤ ├─────────────┼─────────────┼─────────────┴───────────────────────────╯ ├──────┤ XLH ___ X_MH U_BTN2 U_BTN1 X_RH //╰──────╯ ╰─────────────┴─────────────╯ ╰──────╯ ╰─────────────┴─────────────╯ ╰──────╯ )

/ vim: set ft=c tw=174: /

urob commented 1 year ago

Can you send a link to your repo?

chris-ryu commented 1 year ago

Can you send a link to your repo?

https://github.com/chris-ryu/zmk-config

urob commented 1 year ago

You'll have to increase the max-combos-per-key setting to at least 6 for the latest combo setup to work. Like this: https://github.com/urob/zmk-config/blob/b03dda12311ab2e858918176c376cf1213f957dc/config/corneish_zen.conf#L14-L16

chris-ryu commented 1 year ago

👍🏼 Thank you so much. I followed your advice and it fixed the problem.

I really like the new backspace key position and the left thumb position of the return key.
I really appreciate your sharing.