
commit 5a54a139fb69b48c16f02d93f1fe5825b7e37580 Author: urob <978080+urob@users.noreply.github.com> Date: Thu Jul 14 17:10:12 2022 -0400 Move keypos def to nodefree repo commit 0913280899dc3723eb8878267555a51ad0b7fed5 Author: urob <978080+urob@users.noreply.github.com> Date: Thu Jul 14 17:08:04 2022 -0400 Key position maps commit cc5a2c7f2d840944d97e7c1b70d00675b20811e7 Author: urob <978080+urob@users.noreply.github.com> Date: Thu Jul 14 14:58:41 2022 -0400 Move international chars to nodefree repo commit 26d4b90cc24862ce8a8fcea866e34c6f1f942db8 Author: urob <978080+urob@users.noreply.github.com> Date: Thu Jul 14 14:58:11 2022 -0400 Add international character codes commit c21b0828da1036fb4e1e70663fef18b3297bfaeb Author: urob <978080+urob@users.noreply.github.com> Date: Thu Jul 14 13:32:36 2022 -0400 Move keypos def to separate file commit 814682560eb59c2980cc37af84ba2d8cc0ddafe8 Author: urob <978080+urob@users.noreply.github.com> Date: Thu Jul 14 13:23:14 2022 -0400 Rename helper.dtsi to helper.h in zmk-config commit a71187ab35db86fa8f8be320ff1f0f1a8997f68e Author: urob <978080+urob@users.noreply.github.com> Date: Thu Jul 14 13:21:59 2022 -0400 Rename helper.dtsi to helper.h commit 9226fcb12959fde87855cea78e9e396935c2d55c Author: urob <978080+urob@users.noreply.github.com> Date: Thu Jul 14 12:54:32 2022 -0400 Mirror left/right keypos def commit 1a4e680a55ecca650649ec0586392eb0c89d643a Author: urob <978080+urob@users.noreply.github.com> Date: Thu Jul 14 11:43:38 2022 -0400 Add prefix to unicode macro commit 0e4cb3093e114d9060cd41ad191ff65802999d21 Merge: 41ec2cd 04a7df6 Author: urob <978080+urob@users.noreply.github.com> Date: Thu Jul 14 11:38:07 2022 -0400 Merge commit '04a7df637c524525f2964c0a35a3e187760dc79a' as 'zmk-nodefree-config' commit 04a7df637c524525f2964c0a35a3e187760dc79a Author: urob <978080+urob@users.noreply.github.com> Date: Thu Jul 14 11:38:07 2022 -0400 Squashed 'zmk-nodefree-config/' content from commit 0841d09 git-subtree-dir: zmk-nodefree-config git-subtree-split: 0841d0948ac7389a86d15dd42baf03e2832a1b00 commit 41ec2cdb032cd605b65024e8d8fa8ea7578ed85e Author: urob <978080+urob@users.noreply.github.com> Date: Thu Jul 14 11:37:58 2022 -0400 Remove old subtree commit ac2a6c4000d480b78769e1c3f585322b724b0325 Merge: 7599487 188e189 Author: urob <978080+urob@users.noreply.github.com> Date: Thu Jul 14 11:32:33 2022 -0400 Merge commit '188e1891582712e06130eb794aeee34b47e2241b' as 'zmk-nodefree-config' commit 188e1891582712e06130eb794aeee34b47e2241b Author: urob <978080+urob@users.noreply.github.com> Date: Thu Jul 14 11:32:33 2022 -0400 Squashed 'zmk-nodefree-config/' content from commit bd714d8 git-subtree-dir: zmk-nodefree-config git-subtree-split: bd714d81d177a5a4ac231b40a041c9f50c713cc5 commit 7599487fd27a382b7380ef9c37c5a6899d393fff Author: urob <978080+urob@users.noreply.github.com> Date: Thu Jul 14 11:32:21 2022 -0400 Remove old subtree commit 97b0bf3d84910f68e01f9c671e690c9f25cc7e17 Author: urob <978080+urob@users.noreply.github.com> Date: Thu Jul 14 11:30:23 2022 -0400 Move combo and unicode macros to helper.dtsi commit 10703c087dbee780857182840749e5f1f0db25fb Author: urob <978080+urob@users.noreply.github.com> Date: Thu Jul 14 10:28:24 2022 -0400 Testing combo macros
6.1 KiB
zmk-nodefree-config
ZMK lets user customize their keyboard layout by providing a Devicetree file
(.keymap
). The specific syntax requirements of the Devicetree file format can,
however, make this process a bit daunting for new users.
This repository provides simple convenience macros that simplify the configuration for many common use cases. It results in a "node-free" user configuration with a more streamlined syntax. Check out example.keymap to see it in action.
Usage overview
- Copy the file
helper.h
from this repository into the "config" folder of your private zmk-config repository - Source
helper.h
near the top of your.keymap
file:#include "helper.h"
- Customize your keyboard's
.keymap
file. See example.keymap or my personal zmk-config for a complete configuration, and read the documentation below for details.
Usage details
helper.h
provides two convenience macros. ZMK_BEHAVIOR
creates new behaviors, and
ZMK_LAYER
adds new layers to your keymap.
ZMK_BEHAVIOR
The macro is invoked by calling ZMK_BEHAVIOR(name, type, specification)
, expecting
3 arguments:
name
is a unique string chosen by the user (e.g.,my_behavior
). It can later be used to reference the new behavior by preceding it by "&" (e.g.,&my_behavior
)type
selects the behavior that is created. It must be one of the following:caps_word
,hold_tap
,key_repeat
,macro
,mod_morph
,sticky_key
ortap_dance
. Note that two-word types use underscores ("_") to separate words.specification
contains the code customizing the new behavior. It should contain the body of the corresponding ZMK behavior configuration without thelabel
,#binding-cells
andcompatible
properties and without the surrounding node-specification.
Example 1: Creating a custom "homerow mod" tap-hold behavior
ZMK_BEHAVIOR(hrm, hold_tap,
flavor = "balanced";
tapping-term-ms = <280>;
quick-tap-ms = <125>;
global-quick-tap;
bindings = <&kp>, <&kp>;
)
The new behavior can be added to the keymap-layout using &hrm
(e.g., &hrm LSHIFT T
creates a key that yields T
on tap and LSHIFT
on hold, using the custom
configuration above).
Example 2: Creating a custom tap-dance key
ZMK_BEHAVIOR(ss_cw, tap_dance,
tapping-term-ms = <200>;
bindings = <&sk LSHFT>, <&caps_word>;
)
The new behavior can be added to the keymap-layout using &ss_cw
. The key yields
sticky-shift on tap and caps-word on double tap;
Example 3: Creating a custom "win-sleep" macro
ZMK_BEHAVIOR(win_sleep, macro,
wait-ms = <100>;
tap-ms = <5>;
bindings = <&kp LG(X) &kp U &kp S>;
)
This creates a "Windows sleep key" that can be added to the keymap-layout using
&win_sleep
.
ZMK_LAYER
The function is invoked by calling ZMK_LAYER(name, layout)
, expecting
2 arguments:
name
is a unique identifier string chosen by the user (it isn't used elsewhere)layout
provides the layout specification using the same syntax as thebindings
property of the ZMK keymap configuration
Multiple layers can be defined with repeated calls of ZMK_LAYER
. They will be ordered
in the same order in which they are created, with the first-specified layer being
the "lowest" one (see here for details).
Example usage
ZMK_KEYMAP(default_layer,
// ╭─────────────┬─────────────┬─────────────┬─────────────┬─────────────╮ ╭─────────────┬─────────────┬─────────────┬─────────────┬─────────────╮
&kp Q &kp W &kp F &kp P &kp B &kp J &kp L &kp U &kp Y &kp SQT
// ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤
&hrm LGUI A &hrm LALT R &hrm LCTRL S &hrm LSHFT T &kp G &kp M &hrm RSHFT N &hrm LCTRL E &hrm LALT I &hrm LGUI O
// ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤
&kp Z &kp X &kp C &kp D &kp V &kp K &kp H &kp COMMA &kp DOT &kp SEMI
// ╰─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤
&kp ESC < NAV SPACE &kp TAB &kp RET &ss_cw &bs_del_num
// ╰─────────────┴──── ────────┴─────────────╯ ╰─────────────┴─────────────┴─────────────╯
)