Squashed helper-macro branch

commit 62e33866ccc009c645adda95297e147a6bb1b5d4
Author: urob <978080+urob@users.noreply.github.com>
Date:   Wed Jul 13 16:00:08 2022 -0400

    Move helper.dtsi to subtree

commit 635cffa0c1c0a87dadd929701225d30c119a1a9f
Merge: d8dfef3 41c9041
Author: urob <978080+urob@users.noreply.github.com>
Date:   Wed Jul 13 16:56:44 2022 -0400

    Merge commit '41c9041ccc102d7acbc4882434fa5780050a9455' as 'zmk-nodefree-config'

commit 41c9041ccc102d7acbc4882434fa5780050a9455
Author: urob <978080+urob@users.noreply.github.com>
Date:   Wed Jul 13 16:56:44 2022 -0400

    Squashed 'zmk-nodefree-config/' content from commit c7dc05e

    git-subtree-dir: zmk-nodefree-config
    git-subtree-split: c7dc05eb52b14b69ea48059ff418edad6484500e

commit d8dfef3849436176bba1ff3da25ae59d1fa92abe
Author: urob <978080+urob@users.noreply.github.com>
Date:   Mon Jul 11 23:15:51 2022 -0400

    Convenience macros for a cleaner keymap config
This commit is contained in:
urob 2022-07-13 17:14:36 -04:00
parent 308fcb8401
commit 17737c8672
5 changed files with 290 additions and 106 deletions

View file

@ -1,5 +1,7 @@
#include <behaviors.dtsi>
#include <dt-bindings/zmk/keys.h>
#include "mouse.dtsi"
#include "../zmk-nodefree-config/helper.dtsi"
#define XXX &none
#define ___ &trans
@ -14,7 +16,6 @@
#define FN 4
#define UC 5
#include "mouse.dtsi"
#include "unicode.dtsi"
#include "combos.dtsi"
@ -57,95 +58,67 @@ TODOs and ISSUES
// global-quick-tap;
};
/* root node */
/ {
/* homerow mods */
behaviors {
#define LHM LM0 LM1 LM2 LM3 // left-hand HRMs
#define RHM RM1 RM2 RM3 RM4 // right-hand HRMs
#define LHK LT0 LT1 LT2 LT3 LT4 LHM LM4 LB0 LB1 LB2 LB3 LB4 // left-hand keys
#define RHK RT0 RT1 RT2 RT3 RT4 RM0 RHM RB0 RB1 RB2 RB3 RB4 // right-hand keys
#define THK LH0 LH1 LH2 RH0 RH1 RH2 // thumb keys
/* homerow mods */
ZMK_BEHAVIOR(hml, hold_tap,
flavor = "balanced";
tapping-term-ms = <280>;
quick-tap-ms = <125>;
global-quick-tap;
bindings = <&kp>, <&kp>;
hold-trigger-key-positions = <LHM RHK THK>; // include left-hand HRMs for mod-chaining
)
#define LHM LM0 LM1 LM2 LM3 // left-hand HRMs
#define RHM RM1 RM2 RM3 RM4 // right-hand HRMs
#define LHK LT0 LT1 LT2 LT3 LT4 LHM LM4 LB0 LB1 LB2 LB3 LB4 // left-hand keys
#define RHK RT0 RT1 RT2 RT3 RT4 RM0 RHM RB0 RB1 RB2 RB3 RB4 // right-hand keys
#define THK LH0 LH1 LH2 RH0 RH1 RH2 // thumb keys
ZMK_BEHAVIOR(hmr, hold_tap,
flavor = "balanced";
tapping-term-ms = <280>;
quick-tap-ms = <125>;
global-quick-tap;
bindings = <&kp>, <&kp>;
hold-trigger-key-positions = <RHM LHK THK>; // include right-hand HRMs for mod-chaining
)
hml: left_hand_home_row_mods {
compatible = "zmk,behavior-hold-tap";
label = "LEFT_HAND_HOME_ROW_MODS";
flavor = "balanced";
tapping-term-ms = <280>;
quick-tap-ms = <125>;
global-quick-tap;
#binding-cells = <2>;
bindings = <&kp>, <&kp>;
hold-trigger-key-positions = <LHM RHK THK>; // include left-hand HRMs for mod-chaining
};
/* custom keys and macros */
hmr: right_hand_home_row_mods {
compatible = "zmk,behavior-hold-tap";
label = "RIGHT_HAND_HOME_ROW_MODS";
flavor = "balanced";
tapping-term-ms = <280>;
quick-tap-ms = <125>;
global-quick-tap;
#binding-cells = <2>;
bindings = <&kp>, <&kp>;
hold-trigger-key-positions = <RHM LHK THK>; // include right-hand HRMs for mod-chaining
};
// sticky-shift that cancels capsword (used in ss_cw below). Alternatively: mod-morph ss_cw into CANCEL to swallow sticky-shift when capsword is active
ZMK_BEHAVIOR(sticky_shift, macro,
wait-ms = <0>;
tap-ms = <1>;
bindings = <&macro_tap CANCEL> // cancel caps_word;
, <&macro_press &sk LSHFT> // then tap sticky-shift and hold
, <&macro_pause_for_release> // until key release to enable
, <&macro_release &sk LSHFT>; // holding shift
)
/* custom keys and macros */
// tap: sticky shift | double tap: capsword | triple tap: cancel capsword
ZMK_BEHAVIOR(ss_cw, tap_dance,
tapping-term-ms = <200>;
// bindings = <&sticky_shift>, <&caps_word>, <CANCEL>;
bindings = <&sk LSHFT>, <&caps_word>, <CANCEL>;
)
// sticky-shift that cancels capsword (used in ss_cw below). Alternatively: mod-morph ss_cw into CANCEL to swallow sticky-shift when capsword is active
sticky_shift: sticky_shift_cancel_capsword_macro {
compatible = "zmk,behavior-macro";
label = "STICKY_SHIFT_CANCEL_CAPSWORD_MACRO";
wait-ms = <0>;
tap-ms = <1>;
#binding-cells = <0>;
bindings = <&macro_tap CANCEL> // cancel caps_word;
, <&macro_press &sk LSHFT> // then tap sticky-shift and hold
, <&macro_pause_for_release> // until key release to enable
, <&macro_release &sk LSHFT>; // holding shift
};
// tap: backspace | lshft + tap: delete | rshft + tap: shift-delete | hold: num layer
ZMK_BEHAVIOR(bs_del_num, mod_morph,
bindings = <&lt NUM BSPC>, <&kp DEL>;
mods = <(MOD_LSFT|MOD_RSFT)>;
masked_mods = <MOD_LSFT>; // requires PR #1114
)
// tap: sticky shift | double tap: capsword | triple tap: cancel capsword
ss_cw: sticky_shift_capsword_key {
compatible = "zmk,behavior-tap-dance";
label = "STICKY_SHIFT_CAPSWORD_KEY";
tapping-term-ms = <200>;
#binding-cells = <0>;
// bindings = <&sticky_shift>, <&caps_word>, <CANCEL>;
bindings = <&sk LSHFT>, <&caps_word>, <CANCEL>;
};
// Windows sleep key
ZMK_BEHAVIOR(win_sleep, macro,
wait-ms = <50>;
tap-ms = <5>;
bindings = <&kp LG(X) &kp U &kp S>;
)
// tap: backspace | lshft + tap: delete | rshft + tap: shift-delete | hold: num layer
bs_del_num: backspace_del_num_key {
compatible = "zmk,behavior-mod-morph";
label = "BACKSPACE_DEL_NUM_KEY";
#binding-cells = <0>;
bindings = <&lt NUM BSPC>, <&kp DEL>;
mods = <(MOD_LSFT|MOD_RSFT)>;
masked_mods = <MOD_LSFT>; // requires PR #1114
};
// Windows sleep key
win_sleep: win_sleep_macro {
compatible = "zmk,behavior-macro";
label = "WIN_SLEEP_MACRO";
wait-ms = <50>;
tap-ms = <5>;
#binding-cells = <0>;
bindings = <&kp LG(X) &kp U &kp S>;
};
};
keymap {
compatible = "zmk,keymap";
default_layer {
bindings = <
/* 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
// ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ ├─────────────┤ ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤
@ -155,11 +128,9 @@ TODOs and ISSUES
// ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ ├─────────────┤ ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤
EXTRA_BOT_L &lt UC ESC &lt NAV SPACE &lt SYS TAB EXTRA_MID &lt FN RET &ss_cw &bs_del_num EXTRA_BOT_R
// ╰─────────────╯ ╰─────────────┴──── ────────┴─────────────╯ ╰─────────────╯ ╰─────────────┴─────────────┴─────────────╯ ╰─────────────╯
>;
};
)
nav_layer {
bindings = <
ZMK_LAYER(nav_layer,
// ╭─────────────┬─────────────┬─────────────┬─────────────┬─────────────╮ ╭─────────────╮ ╭─────────────┬─────────────┬─────────────┬─────────────┬─────────────╮
___ ___ ___ ___ ___ EXTRA_MID &kp PG_UP &kp HOME &kp UP &kp END &kp INS
// ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ ├─────────────┤ ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤
@ -169,11 +140,9 @@ TODOs and ISSUES
// ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ ├─────────────┤ ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤
EXTRA_BOT_L ___ ___ ___ EXTRA_MID ___ ___ ___ EXTRA_BOT_R
// ╰─────────────╯ ╰─────────────┴──── ────────┴─────────────╯ ╰─────────────╯ ╰─────────────┴─────────────┴─────────────╯ ╰─────────────╯
>;
};
)
sys_layer {
bindings = <
ZMK_LAYER(sys_layer,
// ╭─────────────┬─────────────┬─────────────┬─────────────┬─────────────╮ ╭─────────────╮ ╭─────────────┬─────────────┬─────────────┬─────────────┬─────────────╮
&kp LG(GRAVE) ___ ___ ___ &bootloader EXTRA_MID ___ &kp C_PREV &kp C_VOL_UP &kp C_NEXT &win_sleep
// ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ ├─────────────┤ ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤
@ -183,11 +152,9 @@ TODOs and ISSUES
// ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ ├─────────────┤ ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤
EXTRA_BOT_L ___ ___ ___ EXTRA_MID &kp C_MUTE &kp C_PP ___ EXTRA_BOT_R
// ╰─────────────╯ ╰─────────────┴──── ────────┴─────────────╯ ╰─────────────╯ ╰─────────────┴─────────────┴─────────────╯ ╰─────────────╯
>;
};
)
num_layer {
bindings = <
ZMK_LAYER(num_layer,
// ╭─────────────┬─────────────┬─────────────┬─────────────┬─────────────╮ ╭─────────────╮ ╭─────────────┬─────────────┬─────────────┬─────────────┬─────────────╮
&kp ESC &kp N7 &kp N8 &kp N9 &kp STAR EXTRA_MID ___ ___ ___ ___ ___
// ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ ├─────────────┤ ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤
@ -197,11 +164,9 @@ TODOs and ISSUES
// ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ ├─────────────┤ ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤
EXTRA_BOT_L &kp DOT &kp N0 &kp MINUS EXTRA_MID ___ ___ ___ EXTRA_BOT_R
// ╰─────────────╯ ╰─────────────┴──── ────────┴─────────────╯ ╰─────────────╯ ╰─────────────┴─────────────┴─────────────╯ ╰─────────────╯
>;
};
)
fn_layer {
bindings = <
ZMK_LAYER(fn_layer,
// ╭─────────────┬─────────────┬─────────────┬─────────────┬─────────────╮ ╭─────────────╮ ╭─────────────┬─────────────┬─────────────┬─────────────┬─────────────╮
&kp F12 &kp F7 &kp F8 &kp F9 ___ EXTRA_MID ___ ___ ___ ___ ___
// ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ ├─────────────┤ ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤
@ -211,11 +176,9 @@ TODOs and ISSUES
// ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ ├─────────────┤ ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤
EXTRA_BOT_L &kp F10 &kp F11 &kp F12 EXTRA_MID ___ ___ ___ EXTRA_BOT_R
// ╰─────────────╯ ╰─────────────┴──── ────────┴─────────────╯ ╰─────────────╯ ╰─────────────┴─────────────┴─────────────╯ ╰─────────────╯
>;
};
)
uc_layer {
bindings = <
ZMK_LAYER(uc_layer,
// ╭─────────────┬─────────────┬─────────────┬─────────────┬─────────────╮ ╭─────────────╮ ╭─────────────┬─────────────┬─────────────┬─────────────┬─────────────╮
___ &uc_omega &uc_phi &uc_pi &uc_beta EXTRA_MID ___ &uc_lambda &uc_upsilon &uc_psi &uc_eszett
// ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ ├─────────────┤ ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤
@ -225,9 +188,5 @@ TODOs and ISSUES
// ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ ├─────────────┤ ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤
EXTRA_BOT_L ___ ___ ___ EXTRA_MID ___ ___ ___ EXTRA_BOT_R
// ╰─────────────╯ ╰─────────────┴──── ────────┴─────────────╯ ╰─────────────╯ ╰─────────────┴─────────────┴─────────────╯ ╰─────────────╯
>;
};
};
};
)