diff --git a/config/base.keymap b/config/base.keymap index 3adb2bc..173b920 100644 --- a/config/base.keymap +++ b/config/base.keymap @@ -1,12 +1,3 @@ -/* -ISSUES, WORKAROUNDS and a "ZMK-WISHLIST" - * no tap-only combos (#544), prevents rapid chording of HRMs on combo positions - * &bootloader doesn't work with Planck_rev6 (#1086) - * sticky-hold swallows OS shift when typing quickly, using sticky-tap for now - * native sleep key doesn't work with windows (#1077), using sleep-macro for now - * invalid DFU suffix signature warning when flashing with dfu-util -*/ - #include #include @@ -14,23 +5,6 @@ ISSUES, WORKAROUNDS and a "ZMK-WISHLIST" #include "../zmk-nodefree-config/international_chars/greek.dtsi" #include "../zmk-nodefree-config/international_chars/german.dtsi" -// make a 36 keys layout unless EXTRA-keys are defined in parent .keymap file -#if !defined EXTRA_MID - #define EXTRA_MID -#endif -#if !defined EXTRA_BOT_L - #define EXTRA_BOT_L -#endif -#if !defined EXTRA_BOT_R - #define EXTRA_BOT_R -#endif - -#define XXX &none -#define ___ &trans -#define DSK_PREV &kp LG(LC(LEFT)) // previous desktop on windows -#define DSK_NEXT &kp LG(LC(RIGHT)) // next " " " -#define CANCEL &kp K_CANCEL // cancels caps-word and does nothing else - #define DEF 0 #define NAV 1 #define SYS 2 @@ -38,31 +12,63 @@ ISSUES, WORKAROUNDS and a "ZMK-WISHLIST" #define FN 4 #define UC 5 -#include "combos.dtsi" // source after layer shortcuts +#include "combos.dtsi" // must be sourced after layer-shortcuts #include "mouse.dtsi" +#include "xtr_defaults.h" + +ZMK_CONDITIONAL_LAYER(SYS NUM, FN) // SYS + NUM --> FN + +/* Navigation keys and misc shortcuts */ + +&mt { + flavor = "tap-preferred"; + tapping-term-ms = <220>; + quick-tap-ms = <220>; // repeat on tap-into-hold + hold-trigger-key-positions = <0>; // tap on interrupt +}; + +#define NAV_LEFT &mt HOME LEFT // tap: left | long-tap: beginning of line +#define NAV_RIGHT &mt END 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 + +#define XXX &none +#define ___ &trans + +#define CANCEL &kp K_CANCEL // cancel caps-word and num-word +#define DSK_PREV &kp LG(LC(LEFT)) // previous desktop +#define DSK_NEXT &kp LG(LC(RIGHT)) // next desktop + +/* 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 +&sk { // sticky-key config + release-after-ms = <600>; // release after 0.6s + quick-release; // no double capitalization when rolling keys }; -&sl { // sticky layer config +&sl { // sticky-layer config ignore-modifiers; }; -< { // layer tap config +< { // layer-tap config flavor = "balanced"; tapping-term-ms = <200>; - quick-tap-ms = ; // double-tap + hold repeats tap-key + quick-tap-ms = ; }; -// caps-word and num-word enhancements, requires PR #1441 -&caps_word { /delete-property/ ignore-modifiers; }; // mods deactivate caps-word -&num_word { layers = ; }; +&caps_word { // mods deactivate caps-word, requires PR #1441 + /delete-property/ ignore-modifiers; +}; -/* homerow mods */ +&num_word { // num-word, requires PR #1441 + layers = ; +}; + +/* Homerow mods */ #define KEYS_L LT0 LT1 LT2 LT3 LT4 LM0 LM1 LM2 LM3 LM4 LB0 LB1 LB2 LB3 LB4 // left-hand keys #define KEYS_R RT0 RT1 RT2 RT3 RT4 RM0 RM1 RM2 RM3 RM4 RB0 RB1 RB2 RB3 RB4 // right-hand keys @@ -88,7 +94,16 @@ ZMK_BEHAVIOR(hmr, hold_tap, // right-hand HRMs hold-trigger-on-release; // requires PR #1423 ) -/* custom keys and macros */ +/* Custom behaviors */ + +// tap: num-word | hold: num-layer +ZMK_BEHAVIOR(num_layer_word, hold_tap, + flavor = "balanced"; + tapping-term-ms = <200>; + quick-tap-ms = ; + bindings = <&mo>, <&num_word>; +) +#define NUM_WORD &num_layer_word NUM 0 // tap: sticky shift | double tap: capsword | triple tap: cancel capsword // ZMK_BEHAVIOR(ss_cw, tap_dance, @@ -102,10 +117,10 @@ ZMK_BEHAVIOR(ss_cw, mod_morph, ) // tap: backspace | lshft + tap: delete | rshft + tap: shift-delete | hold: num layer -ZMK_BEHAVIOR(bs_del_num, mod_morph, - bindings = << NUM BSPC>, <&kp DEL>; +ZMK_BEHAVIOR(bs_del_sys, mod_morph, + bindings = << SYS BSPC>, <&kp DEL>; mods = <(MOD_LSFT|MOD_RSFT)>; - masked-mods = ; // requires PR #1412 + keep-mods = ; // requires PR #1412 ) // tap: space | space + tap: dot -> space -> sticky shift | hold: activate layer @@ -151,78 +166,98 @@ ZMK_BEHAVIOR(sls, sticky_key, ignore-modifiers; ) -/* keymap */ +// tap: comma | shift + tap: semicolon | ctrl + shift + tap: < +ZMK_BEHAVIOR(dot_inner_morph, mod_morph, + bindings = <&kp DOT>, <&kp COLON>; + mods = <(MOD_LSFT|MOD_RSFT)>; +) +ZMK_BEHAVIOR(dot_morph, mod_morph, + bindings = <&dot_inner_morph>, <&kp DOT>; + mods = <(MOD_LCTL|MOD_RCTL)>; +) + +// tap: dot | shift + tap: colon | ctrl + shift + tap: > +ZMK_BEHAVIOR(comma_inner_morph, mod_morph, + bindings = <&kp COMMA>, <&kp SEMICOLON>; + mods = <(MOD_LSFT|MOD_RSFT)>; +) +ZMK_BEHAVIOR(comma_morph, mod_morph, + bindings = <&comma_inner_morph>, <&kp COMMA>; + mods = <(MOD_LCTL|MOD_RCTL)>; +) + +/* Keymap */ ZMK_LAYER(default_layer, // ╭─────────────┬─────────────┬─────────────┬─────────────┬─────────────╮ ╭─────────────╮ ╭─────────────┬─────────────┬─────────────┬─────────────┬─────────────╮ - &kp Q &kp W &kp F &kp P &kp B EXTRA_MID &kp J &kp L &kp U &kp Y &kp SQT + &kp Q &kp W &kp F &kp P &kp B XTR_MT &kp J &kp L &kp U &kp Y &kp SQT // ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ ├─────────────┤ ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ - &hml LGUI A &hml LALT R &hml LCTRL S &hml LSHFT T &kp G EXTRA_MID &kp M &hmr RSHFT N &hmr LCTRL E &hmr LALT I &hmr LGUI O + &hml LGUI A &hml LALT R &hml LCTRL S &hml LSHFT T &kp G XTR_MM &kp M &hmr RSHFT N &hmr LCTRL E &hmr LALT I &hmr LGUI O // ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ ├─────────────┤ ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ - &kp Z &kp X &kp C &kp D &kp V EXTRA_MID &kp K &kp H &kp COMMA &kp DOT &kp SEMI - // ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ ├─────────────┤ ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ - EXTRA_BOT_L < SYS ESC <_spc NAV 0 < UC TAB EXTRA_MID < FN RET &ss_cw &bs_del_num EXTRA_BOT_R - // ╰─────────────╯ ╰─────────────┴─────────────┴─────────────╯ ╰─────────────╯ ╰─────────────┴─────────────┴─────────────╯ ╰─────────────╯ + &kp Z &kp X &kp C &kp D &kp V XTR_MB &kp K &kp H &comma_morph &dot_morph &key_repeat + // ├─────────────┼─────────────┴─────────────┼─────────────┼─────────────┤ ├─────────────┤ ├─────────────┼─────────────┼─────────────┴─────────────┼─────────────┤ + XTR_LH &bs_del_sys <_spc NAV 0 XTR_MH &ss_cw NUM_WORD XTR_RH + // ╰─────────────╯ ╰─────────────┴─────────────╯ ╰─────────────╯ ╰─────────────┴─────────────╯ ╰─────────────╯ ) ZMK_LAYER(nav_layer, // ╭─────────────┬─────────────┬─────────────┬─────────────┬─────────────╮ ╭─────────────╮ ╭─────────────┬─────────────┬─────────────┬─────────────┬─────────────╮ - ___ ___ ___ ___ ___ EXTRA_MID &kp PG_UP &kp HOME &kp UP &kp END &kp INS + ___ ___ ___ ___ ___ XTR_MT &kp PG_UP NAV_BSPC NAV_UP NAV_DEL ___ // ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ ├─────────────┤ ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ - &sk LGUI &sk LALT &sk LCTRL &sk LSHFT ___ EXTRA_MID &kp PG_DN &kp LEFT &kp DOWN &kp RIGHT &kp DEL + &sk LGUI &sk LALT &sk LCTRL &sk LSHFT ___ XTR_MM &kp PG_DN NAV_LEFT NAV_DOWN NAV_RIGHT &kp RET // ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ ├─────────────┤ ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ - ___ ___ ___ ___ ___ EXTRA_MID ___ &kp LC(X) ©_cut &kp LS(INS) ___ - // ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ ├─────────────┤ ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ - EXTRA_BOT_L ___ ___ ___ EXTRA_MID ___ ___ ___ EXTRA_BOT_R - // ╰─────────────╯ ╰─────────────┴─────────────┴─────────────╯ ╰─────────────╯ ╰─────────────┴─────────────┴─────────────╯ ╰─────────────╯ + ___ ___ ___ ___ ___ XTR_MB &kp INS &kp TAB ©_cut &kp LS(INS) ___ + // ├─────────────┼─────────────┴─────────────┼─────────────┼─────────────┤ ├─────────────┤ ├─────────────┼─────────────┼─────────────┴─────────────┼─────────────┤ + XTR_LH ___ ___ XTR_MH ___ CANCEL XTR_RH + // ╰─────────────╯ ╰─────────────┴─────────────╯ ╰─────────────╯ ╰─────────────┴─────────────╯ ╰─────────────╯ ) ZMK_LAYER(sys_layer, // ╭─────────────┬─────────────┬─────────────┬─────────────┬─────────────╮ ╭─────────────╮ ╭─────────────┬─────────────┬─────────────┬─────────────┬─────────────╮ - &kp LG(GRAVE) ___ ___ &reset &bootloader EXTRA_MID ___ &kp C_PREV &kp C_VOL_UP &kp C_NEXT &win_sleep + &kp LG(GRAVE) ___ ___ &reset &bootloader XTR_MT ___ &kp C_PREV &kp C_VOL_UP &kp C_NEXT &win_sleep // ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ ├─────────────┤ ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ - &sk LGUI &sk LALT &sk LCTRL &sk LSHFT ___ EXTRA_MID ___ DSK_PREV &kp C_VOL_DN DSK_NEXT ___ + &sk LGUI &sk LALT &sk LCTRL &sk LSHFT ___ XTR_MM ___ DSK_PREV &kp C_VOL_DN DSK_NEXT ___ // ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ ├─────────────┤ ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ - ___ ___ ___ ___ ___ EXTRA_MID ___ ___ ___ ___ ___ - // ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ ├─────────────┤ ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ - EXTRA_BOT_L ___ ___ ___ EXTRA_MID &kp C_MUTE &kp C_PP ___ EXTRA_BOT_R - // ╰─────────────╯ ╰─────────────┴─────────────┴─────────────╯ ╰─────────────╯ ╰─────────────┴─────────────┴─────────────╯ ╰─────────────╯ + ___ ___ ___ ___ ___ XTR_MB ___ ___ ___ ___ ___ + // ├─────────────┼─────────────┴─────────────┼─────────────┼─────────────┤ ├─────────────┤ ├─────────────┼─────────────┼─────────────┴─────────────┼─────────────┤ + XTR_LH ___ ___ XTR_MH &kp C_PP &kp C_MUTE XTR_RH + // ╰─────────────╯ ╰─────────────┴─────────────╯ ╰─────────────╯ ╰─────────────┴─────────────╯ ╰─────────────╯ ) ZMK_LAYER(num_layer, // ╭─────────────┬─────────────┬─────────────┬─────────────┬─────────────╮ ╭─────────────╮ ╭─────────────┬─────────────┬─────────────┬─────────────┬─────────────╮ - &kp ESC &kp N7 &kp N8 &kp N9 ___ EXTRA_MID ___ ___ ___ ___ ___ + ___ &kp N7 &kp N8 &kp N9 ___ XTR_MT ___ ___ ___ ___ ___ // ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ ├─────────────┤ ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ - &kp TAB &kp N4 &kp N5 &kp N6 &kp DOT EXTRA_MID ___ ___ ___ ___ ___ + &hml LGUI N0 &hml LALT N4 &hml LCTRL N5 &hml LSHFT N6 ___ XTR_MM ___ ___ ___ ___ ___ // ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ ├─────────────┤ ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ - ___ &kp N1 &kp N2 &kp N3 &kp COMMA EXTRA_MID ___ ___ ___ ___ ___ - // ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ ├─────────────┤ ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ - EXTRA_BOT_L ___ ___ &kp N0 EXTRA_MID ___ ___ ___ EXTRA_BOT_R - // ╰─────────────╯ ╰─────────────┴─────────────┴─────────────╯ ╰─────────────╯ ╰─────────────┴─────────────┴─────────────╯ ╰─────────────╯ + ___ &kp N1 &kp N2 &kp N3 ___ XTR_MB ___ ___ ___ ___ ___ + // ├─────────────┼─────────────┴─────────────┼─────────────┼─────────────┤ ├─────────────┤ ├─────────────┼─────────────┼─────────────┴─────────────┼─────────────┤ + XTR_LH ___ ___ XTR_MH ___ ___ XTR_RH + // ╰─────────────╯ ╰─────────────┴─────────────╯ ╰─────────────╯ ╰─────────────┴─────────────╯ ╰─────────────╯ ) ZMK_LAYER(fn_layer, // ╭─────────────┬─────────────┬─────────────┬─────────────┬─────────────╮ ╭─────────────╮ ╭─────────────┬─────────────┬─────────────┬─────────────┬─────────────╮ - &kp F12 &kp F7 &kp F8 &kp F9 ___ EXTRA_MID ___ ___ ___ ___ ___ + &kp F12 &kp F7 &kp F8 &kp F9 ___ XTR_MT ___ ___ ___ ___ ___ // ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ ├─────────────┤ ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ - &kp F11 &kp F4 &kp F5 &kp F6 ___ EXTRA_MID ___ &sk RSHFT &sk LCTRL &sk LALT &sk LGUI + &kp F11 &kp F4 &kp F5 &kp F6 ___ XTR_MM ___ &sk RSHFT &sk LCTRL &sk LALT &sk LGUI // ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ ├─────────────┤ ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ - &kp F10 &kp F1 &kp F2 &kp F3 ___ EXTRA_MID ___ ___ ___ ___ ___ - // ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ ├─────────────┤ ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ - EXTRA_BOT_L ___ ___ ___ EXTRA_MID ___ ___ ___ EXTRA_BOT_R - // ╰─────────────╯ ╰─────────────┴─────────────┴─────────────╯ ╰─────────────╯ ╰─────────────┴─────────────┴─────────────╯ ╰─────────────╯ + &kp F10 &kp F1 &kp F2 &kp F3 ___ XTR_MB ___ ___ ___ ___ ___ + // ├─────────────┼─────────────┴─────────────┼─────────────┼─────────────┤ ├─────────────┤ ├─────────────┼─────────────┼─────────────┴─────────────┼─────────────┤ + XTR_LH ___ ___ XTR_MH ___ ___ XTR_RH + // ╰─────────────╯ ╰─────────────┴─────────────╯ ╰─────────────╯ ╰─────────────┴─────────────╯ ╰─────────────╯ ) ZMK_LAYER(uc_layer, // ╭─────────────┬─────────────┬─────────────┬─────────────┬─────────────╮ ╭─────────────╮ ╭─────────────┬─────────────┬─────────────┬─────────────┬─────────────╮ - ___ &el_omega &el_phi &el_pi &el_beta EXTRA_MID ___ &el_lambda &el_upsilon &el_psi &de_eszett + ___ &el_omega &el_phi &el_pi &el_beta XTR_MT ___ &el_lambda &el_upsilon &el_psi &de_eszett // ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ ├─────────────┤ ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ - &el_alpha &el_rho &el_sigma &el_tau &el_gamma EXTRA_MID &el_mu &el_nu &el_epsilon &el_iota &el_omikron + &el_alpha &el_rho &el_sigma &el_tau &el_gamma XTR_MM &el_mu &el_nu &el_epsilon &el_iota &el_omikron // ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ ├─────────────┤ ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ - &el_zeta &el_xi &el_chi &el_delta &el_theta EXTRA_MID &el_kappa &el_eta &de_ae &de_oe &de_ue - // ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ ├─────────────┤ ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ - EXTRA_BOT_L ___ ___ ___ EXTRA_MID ___ ___ ___ EXTRA_BOT_R - // ╰─────────────╯ ╰─────────────┴─────────────┴─────────────╯ ╰─────────────╯ ╰─────────────┴─────────────┴─────────────╯ ╰─────────────╯ + &el_zeta &el_xi &el_chi &el_delta &el_theta XTR_MB &el_kappa &el_eta &de_ae &de_oe &de_ue + // ├─────────────┼─────────────┴─────────────┼─────────────┼─────────────┤ ├─────────────┤ ├─────────────┼─────────────┼─────────────┴─────────────┼─────────────┤ + XTR_LH ___ ___ XTR_MH ___ ___ XTR_RH + // ╰─────────────╯ ╰─────────────┴─────────────╯ ╰─────────────╯ ╰───────────────────────────╯ ╰─────────────╯ ) /* vim: set tw=180: */ diff --git a/config/combos.dtsi b/config/combos.dtsi index 45d49ab..19466c9 100644 --- a/config/combos.dtsi +++ b/config/combos.dtsi @@ -15,46 +15,46 @@ #define COMBO_TERM_SLOW 35 /* Punctuation (horizontal left hand) */ -// ZMK_COMBO_ADV(num, &tog NUM, LT3 LT1, DEF NUM, COMBO_TERM_SLOW) -ZMK_COMBO_ADV(num, &num_word, LT3 LT1, DEF NUM, COMBO_TERM_SLOW) -ZMK_COMBO_ADV(all, &kp LC(A), LT3 LT2, DEF NUM, COMBO_TERM_FAST) -ZMK_COMBO_ADV(app, &kp LG(SPACE), LT2 LT1, DEF NUM, COMBO_TERM_FAST) +ZMK_COMBO_ADV(num, &num_word, LT3 LT1, DEF NAV NUM, COMBO_TERM_SLOW) +ZMK_COMBO_ADV(esc, &kp ESC, LT3 LT2, DEF NAV NUM, COMBO_TERM_FAST) +ZMK_COMBO_ADV(app, &kp LG(SPACE), LT2 LT1, DEF NAV NUM, COMBO_TERM_FAST) -ZMK_COMBO_ADV(excl, &kp EXCL, LM3 LM2, DEF NUM, COMBO_TERM_FAST) -ZMK_COMBO_ADV(qmark, &kp QMARK, LM2 LM1, DEF NUM, COMBO_TERM_FAST) +ZMK_COMBO_ADV(excl, &kp EXCL, LM3 LM2, DEF NAV NUM, COMBO_TERM_FAST) +ZMK_COMBO_ADV(qmark, &kp QMARK, LM2 LM1, DEF NAV NUM, COMBO_TERM_FAST) -ZMK_COMBO_ADV(cut, &kp LC(X), LB3 LB1, DEF NUM, COMBO_TERM_SLOW) -ZMK_COMBO_ADV(copy, &kp LC(INS), LB3 LB2, DEF NUM, COMBO_TERM_FAST) -ZMK_COMBO_ADV(paste, &kp LS(INS), LB2 LB1, DEF NUM, COMBO_TERM_FAST) +ZMK_COMBO_ADV(cut, &kp LC(X), LB3 LB1, DEF NAV NUM, COMBO_TERM_SLOW) +ZMK_COMBO_ADV(copy, &kp LC(INS), LB3 LB2, DEF NAV NUM, COMBO_TERM_FAST) +ZMK_COMBO_ADV(paste, &kp LS(INS), LB2 LB1, DEF NAV NUM, COMBO_TERM_FAST) /* Brackets (horizontal right hand) */ -ZMK_COMBO_ADV(lbrc, &kp LBRC, RT1 RT2, DEF NUM, COMBO_TERM_FAST) -ZMK_COMBO_ADV(rbrc, &kp RBRC, RT2 RT3, DEF NUM, COMBO_TERM_FAST) -ZMK_COMBO_ADV(lpar, &kp LPAR, RM1 RM2, DEF NUM, COMBO_TERM_FAST) -ZMK_COMBO_ADV(rpar, &kp RPAR, RM2 RM3, DEF NUM, COMBO_TERM_FAST) -ZMK_COMBO_ADV(lbrk, &kp LBKT, RB1 RB2, DEF NUM, COMBO_TERM_FAST) -ZMK_COMBO_ADV(rbrk, &kp RBKT, RB2 RB3, DEF NUM, COMBO_TERM_FAST) +ZMK_COMBO_ADV(lbrc, &kp LBRC, RT1 RT2, DEF NAV NUM, COMBO_TERM_FAST) +ZMK_COMBO_ADV(rbrc, &kp RBRC, RT2 RT3, DEF NAV NUM, COMBO_TERM_FAST) +ZMK_COMBO_ADV(lpar, &kp LPAR, RM1 RM2, DEF NAV NUM, COMBO_TERM_FAST) +ZMK_COMBO_ADV(rpar, &kp RPAR, RM2 RM3, DEF NAV NUM, COMBO_TERM_FAST) +ZMK_COMBO_ADV(lbrk, &kp LBKT, RB1 RB2, DEF NAV NUM, COMBO_TERM_FAST) +ZMK_COMBO_ADV(rbrk, &kp RBKT, RB2 RB3, DEF NAV NUM, COMBO_TERM_FAST) + +ZMK_COMBO_ADV(grk, &sl UC, RT1 RT3, DEF NAV NUM, COMBO_TERM_SLOW) +ZMK_COMBO_ADV(cpgrk, &sls 0, RT1 RT2 RT3, DEF NAV NUM, COMBO_TERM_SLOW) /* Other symbols (vertical combos) */ -ZMK_COMBO_ADV(at, &kp AT, LT3 LM3, DEF NUM, COMBO_TERM_SLOW) -ZMK_COMBO_ADV(hash, &kp HASH, LT2 LM2, DEF NUM, COMBO_TERM_SLOW) -ZMK_COMBO_ADV(dllr, &kp DLLR, LT1 LM1, DEF NUM, COMBO_TERM_SLOW) -ZMK_COMBO_ADV(prcnt, &kp PRCNT, LT0 LM0, DEF NUM, COMBO_TERM_SLOW) +ZMK_COMBO_ADV(at, &kp AT, LT3 LM3, DEF NAV NUM, COMBO_TERM_SLOW) +ZMK_COMBO_ADV(hash, &kp HASH, LT2 LM2, DEF NAV NUM, COMBO_TERM_SLOW) +ZMK_COMBO_ADV(dllr, &kp DLLR, LT1 LM1, DEF NAV NUM, COMBO_TERM_SLOW) +ZMK_COMBO_ADV(prcnt, &kp PRCNT, LT0 LM0, DEF NAV NUM, COMBO_TERM_SLOW) -ZMK_COMBO_ADV(caret, &kp CARET, RT0 RM0, DEF NUM, COMBO_TERM_SLOW) -ZMK_COMBO_ADV(plus, &kp PLUS, RT1 RM1, DEF NUM, COMBO_TERM_SLOW) -ZMK_COMBO_ADV(star, &kp STAR, RT2 RM2, DEF NUM, COMBO_TERM_SLOW) -ZMK_COMBO_ADV(amps, &kp AMPS, RT3 RM3, DEF NUM, COMBO_TERM_SLOW) +ZMK_COMBO_ADV(caret, &kp CARET, RT0 RM0, DEF NAV NUM, COMBO_TERM_SLOW) +ZMK_COMBO_ADV(plus, &kp PLUS, RT1 RM1, DEF NAV NUM, COMBO_TERM_SLOW) +ZMK_COMBO_ADV(star, &kp STAR, RT2 RM2, DEF NAV NUM, COMBO_TERM_SLOW) +ZMK_COMBO_ADV(amps, &kp AMPS, RT3 RM3, DEF NAV NUM, COMBO_TERM_SLOW) -ZMK_COMBO_ADV(grave, &kp GRAVE, LM3 LB3, DEF NUM, COMBO_TERM_SLOW) -ZMK_COMBO_ADV(bslh, &kp BSLH, LM2 LB2, DEF NUM, COMBO_TERM_SLOW) -ZMK_COMBO_ADV(tilde, &kp TILDE, LM1 LB1, DEF NUM, COMBO_TERM_SLOW) -ZMK_COMBO_ADV(equal, &kp EQUAL, LM0 LB0, DEF NUM, COMBO_TERM_SLOW) +ZMK_COMBO_ADV(grave, &kp GRAVE, LM3 LB3, DEF NAV NUM, COMBO_TERM_SLOW) +ZMK_COMBO_ADV(bslh, &kp BSLH, LM2 LB2, DEF NAV NUM, COMBO_TERM_SLOW) +ZMK_COMBO_ADV(equal, &kp EQUAL, LM1 LB1, DEF NAV NUM, COMBO_TERM_SLOW) +ZMK_COMBO_ADV(tilde, &kp TILDE, LM0 LB0, DEF NAV NUM, COMBO_TERM_SLOW) -ZMK_COMBO_ADV(under, &kp UNDER, RM0 RB0, DEF NUM, COMBO_TERM_SLOW) -ZMK_COMBO_ADV(minus, &kp MINUS, RM1 RB1, DEF NUM, COMBO_TERM_SLOW) -ZMK_COMBO_ADV(fslh, &kp FSLH, RM2 RB2, DEF NUM, COMBO_TERM_SLOW) -ZMK_COMBO_ADV(pipe, &kp PIPE, RM3 RB3, DEF NUM, COMBO_TERM_SLOW) +ZMK_COMBO_ADV(under, &kp UNDER, RM0 RB0, DEF NAV NUM, COMBO_TERM_SLOW) +ZMK_COMBO_ADV(minus, &kp MINUS, RM1 RB1, DEF NAV NUM, COMBO_TERM_SLOW) +ZMK_COMBO_ADV(fslh, &kp FSLH, RM2 RB2, DEF NAV NUM, COMBO_TERM_SLOW) +ZMK_COMBO_ADV(pipe, &kp PIPE, RM3 RB3, DEF NAV NUM, COMBO_TERM_SLOW) -ZMK_COMBO_ADV(grk, &sl UC, RT1 RT3, DEF NUM, COMBO_TERM_SLOW) -ZMK_COMBO_ADV(cpgrk, &sls 0, RT1 RT2 RT3, DEF NUM, COMBO_TERM_SLOW) diff --git a/config/planck_rev6.keymap b/config/planck_rev6.keymap index 191cf7b..dc1788c 100644 --- a/config/planck_rev6.keymap +++ b/config/planck_rev6.keymap @@ -2,9 +2,12 @@ #include "../zmk-nodefree-config/keypos_def/keypos_48keys_wide.h" /* map Planck's extra keys */ -#define EXTRA_MID &none &none // 3x2 middle keys -#define EXTRA_BOT_L &none &kp LGUI // 1x2 bottom left keys -#define EXTRA_BOT_R &mwh SCROLL_DOWN &mwh SCROLL_UP // 1x2 bottom right keys +#define XTR_MT &none &none // top row, middle +#define XTR_MM &none &none // middle row, middle +#define XTR_MB &none &none // bottom row, middle +#define XTR_MH &kp BSPC &none &none &kp RET // thumb row, middle +#define XTR_LH &none &kp LGUI // thumb row, left +#define XTR_RH &mwh SCROLL_DOWN &mwh SCROLL_UP // thumb row, right /* source the main keymap */ #include "base.keymap" diff --git a/config/xtr_defaults.h b/config/xtr_defaults.h new file mode 100644 index 0000000..18ea8e7 --- /dev/null +++ b/config/xtr_defaults.h @@ -0,0 +1,22 @@ +// The default layout has 34 keys. Additional keys can be added by pre-setting any of +// the macros defined in this file to one or more keys before sourcing this file. + +#if !defined XTR_MT // top row, middle + #define XTR_MT +#endif +#if !defined XTR_MM // middle row, middle + #define XTR_MM +#endif +#if !defined XTR_MB // bottom row, middle + #define XTR_MB +#endif +#if !defined XTR_MH // thumb row, middle + #define XTR_MH +#endif +#if !defined XTR_LH // thumb row, left + #define XTR_LH +#endif +#if !defined XTR_RH // thumb row, right + #define XTR_RH +#endif + diff --git a/img/keymap.png b/img/keymap.png index 7dce0c3..4feb9cd 100644 Binary files a/img/keymap.png and b/img/keymap.png differ diff --git a/readme.md b/readme.md index 132ec21..0ecbb9b 100644 --- a/readme.md +++ b/readme.md @@ -1,22 +1,26 @@ # urob's zmk-config This is my personal [ZMK firmware](https://github.com/zmkfirmware/zmk/) configuration. -It is ported from my QMK configuration, which in turn is heavily inspired by Manna Harbour's -[Miryoku layout](https://github.com/manna-harbour/miryoku). ## Key features - clean keymap + unicode setup using helper macros from [zmk-nodefree-config](https://github.com/urob/zmk-nodefree-config) -- keymap and combo setup portable across different physical layouts -- ["timeless" homerow mods](#timeless-homerow-mods) on the base layer; - sticky mods on other layers +- keymap and combo setup are independent of the physical location of keys and are + (re)used for multiple keyboards with a varying number of keys +- ["timeless" homerow mods](#timeless-homerow-mods) on the base layer; sticky mods on + other layers - num-word: a zmk version of smart-layers that automatically de-activate for non-numbers - combos replacing the symbol layer +- arrow-cluster doubles as home/end/beginning of document/end of document on long-press, + backspace/delete delete words on long-press - sticky shift on right thumb, double-tap (or shift + tap)[^1] activates caps-word +- shift + comma morph into semicolon, shift + control + comma morph into less-than, + shift + dot morph into colon, shift + control + dot morph into greater-than - shift + space morphs into dot + space + sticky-shift -- shift + backspace morphs into delete -- "Greek" layer for mathematical typesetting +- conditional layer: "sys" + "num" layer yield "fun" layer +- "repeat" on right bottom pinky +- "Greek" layer for mathematical typesetting (activated via sticky-layer combo) ![](img/keymap.png) @@ -88,8 +92,8 @@ are not necessary): ZMK_BEHAVIOR(hml, hold_tap, flavor = "balanced"; tapping-term-ms = <280>; - quick-tap-ms = <175>; // double tapping same key allows for repeating - global-quick-tap-ms = <150>; // without PR #1387 use global-quick-tap instead + quick-tap-ms = <175>; // repeat on tap-into-hold + global-quick-tap-ms = <150>; // requires PR #1387 bindings = <&kp>, <&kp>; hold-trigger-key-positions = ; hold-trigger-on-release; // requires PR #1423 @@ -99,8 +103,8 @@ ZMK_BEHAVIOR(hml, hold_tap, ZMK_BEHAVIOR(hmr, hold_tap, flavor = "balanced"; tapping-term-ms = <280>; - quick-tap-ms = <175>; // double tapping same key allows for repeating - global-quick-tap-ms = <150>; // without PR #1387 use global-quick-tap instead + quick-tap-ms = <175>; // repeat on tap-into-hold + global-quick-tap-ms = <150>; // requires PR #1387 bindings = <&kp>, <&kp>; hold-trigger-key-positions = ; hold-trigger-on-release; // requires PR #1423 @@ -120,21 +124,65 @@ custom selection of PRs, you might find my ["cookbook approach"](https://gist.github.com/urob/68a1e206b2356a01b876ed02d3f542c7) helpful. -## A few thoughts on the combo setup +## Combo setup -The combo layout is guided by two goals: (1) put all combos in easy-to-access locations, -and (2) make them easy to remember. Specifically: +I make heavy use of combos to replace the usual symbol layer. The combo layout aims to +put the most used symbols in easy-to-access locations and also make them easy to +remember. Specifically: -- the top vertical-combo row matches the symbols on a standard numbers row - (except `+` and `&` being swapped) -- the bottom vertical-combo row aims for symmetry with the top row - (subscript `_` aligns with superscript `^`; minus `-` aligns with `+`; division `/` - aligns with multiplication `*`; logical-or `|` aligns with logical-and `&`) -- parenthesis, braces, brackets, `!` and `?` all in prime access locations and set up - symmetrically -- a numlock shortcut (on `W + P`) for one-handed "data entry" (aka Sudoku 🙂) -- shortcuts for cut (on `X + D`), copy, and paste on left side (good with right-handed - mouse use) +- the top vertical-combo row matches the symbols on a standard numbers row (except `+` + and `&` being swapped) +- the bottom vertical-combo row aims for symmetry with the top row (subscript `_` aligns + with superscript `^`; minus `-` aligns with `+`; division `/` aligns with + multiplication `*`; logical-or `|` aligns with logical-and `&`) +- parenthesis, braces, brackets, `!` and `?` are set up symmetrically in prime locations +- numlock (on `W + P`), cut (on `X + D`), copy, and paste are on the left side for + one-handed mouse use +- `L + Y` activates Greek layer for next key, `L + U + Y` activates shifted Greek layer + for next key + +## Experimental changes + +- I recently reduced my core layout to 34 keys. Backspace, Delete and Tap are now all on +my Navigation-layer. To make room for these keys, I have added hold-taps to the arrow +cluster, which now double as Home/End and Beginning/End of document. I really like the +new navigation cluster and will likely keep it in one way or another +- Inspired by Jonas Hietala's + [Numword](https://www.jonashietala.se/blog/2021/06/03/the-t-34-keyboard-layout/#where-are-the-digits) + for QMK, I implemented my own version of [Smart-layers for + ZMK](https://github.com/zmkfirmware/zmk/pull/1451). It is triggered via a single tap + on my Num-key (holding the key will activate the num layer as usual without + triggering Numword). Similar to Capsword, Numword continues to be activated as long + as I type numbers, and deactivates automatically on any other keypress. I found that + I use Numword for most of my numbers typing. For single digits, it effectively is a + sticky-layer, but importantly I can also use it for multiple digits. The only case + where it doesn't deactivate automatically is where immediately after a digit I would + type any of the letters on which my numpad is located (WFPRSTXCD), which is rare, + but does happen. For these cases I have a CANCEL key on my Nav layer that cancels + both Numword and Capsword. +- Since the switch to 34 keys, I freed up the tap-position on my left-most thumb key. + For now I added a secondary Bspc, but I am still searching for a better use. (I tried + adding Repeat here but I found that it doesn't work well adjacent to space) + +## Issues and workarounds + +Since I switched from QMK to ZMK I have been very impressed with how easy it is to set +up relatively complex layouts in ZMK. For the most parts I don't miss any functionality +(to the contrary, I found that ZMK supports many features natively that would complex +user-space implementations in QMK). Below are a few remaining issues: + +- ZMK does not yet support tap-only combos + ([#544](https://github.com/zmkfirmware/zmk/issues/544)). Workaround: pause + briefly when chording multiple HRMs together on positions that otherwise would trigger + a combo. +- `&bootloader` doesn't work with Planck_rev6 + ([#1086](https://github.com/zmkfirmware/zmk/issues/1086)). Workaround: Manually press + reset-button. +- "sticky-hold" swallows OS shift when typing quickly. Workaround: use sticky-tap for now. +- Sleep is not yet implemented ([#1077](https://github.com/zmkfirmware/zmk/issues/1077)). + Workaround: use sleep-macro instead. +- Invalid DFU suffix signature warning when flashing with dfu-util. No problem for now + but may cause issues with future versions of dfu-util. [^1]: Really what's happening is that `Shift` + my right home-thumb morph into caps-word. This gives me two separate ways of activating it: (1) Holding the diff --git a/zmk-nodefree-config/helper.h b/zmk-nodefree-config/helper.h index 8950b64..af000ec 100644 --- a/zmk-nodefree-config/helper.h +++ b/zmk-nodefree-config/helper.h @@ -136,7 +136,6 @@ #binding-cells = <0>; \ bindings = , ; \ mods = <(MOD_LSFT|MOD_RSFT)>; \ - masked-mods = <(MOD_LSFT|MOD_RSFT)>; \ }; \ }; \ };