From 0b6979f97e10e0080e4696dafa215edbf5aa187b Mon Sep 17 00:00:00 2001 From: urob <978080+urob@users.noreply.github.com> Date: Thu, 14 Jul 2022 17:16:44 -0400 Subject: [PATCH] Move combos/unicode to nodefree repo (squashed) 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 --- config/base.keymap | 17 +-- config/combos.dtsi | 98 ++++++-------- config/planck_rev6.keymap | 64 +-------- config/unicode.dtsi | 72 ----------- zmk-nodefree-config/README.md | 8 +- zmk-nodefree-config/example.keymap | 2 +- zmk-nodefree-config/helper.dtsi | 32 ----- zmk-nodefree-config/helper.h | 122 ++++++++++++++++++ .../international_chars/german.dtsi | 6 + .../international_chars/greek.dtsi | 25 ++++ .../keypos_def/keypos_34keys.h | 53 ++++++++ .../keypos_def/keypos_36keys.h | 55 ++++++++ .../keypos_def/keypos_42keys.h | 61 +++++++++ .../keypos_def/keypos_48keys.h | 67 ++++++++++ .../keypos_def/keypos_48keys_wide.h | 59 +++++++++ 15 files changed, 507 insertions(+), 234 deletions(-) delete mode 100644 config/unicode.dtsi delete mode 100644 zmk-nodefree-config/helper.dtsi create mode 100644 zmk-nodefree-config/helper.h create mode 100644 zmk-nodefree-config/international_chars/german.dtsi create mode 100644 zmk-nodefree-config/international_chars/greek.dtsi create mode 100644 zmk-nodefree-config/keypos_def/keypos_34keys.h create mode 100644 zmk-nodefree-config/keypos_def/keypos_36keys.h create mode 100644 zmk-nodefree-config/keypos_def/keypos_42keys.h create mode 100644 zmk-nodefree-config/keypos_def/keypos_48keys.h create mode 100644 zmk-nodefree-config/keypos_def/keypos_48keys_wide.h diff --git a/config/base.keymap b/config/base.keymap index 88eb044..57dddd0 100644 --- a/config/base.keymap +++ b/config/base.keymap @@ -15,8 +15,9 @@ ISSUES, WORKAROUNDS and a "ZMK-WISHLIST" #include #include -#include "mouse.dtsi" -#include "../zmk-nodefree-config/helper.dtsi" +#include "../zmk-nodefree-config/helper.h" +#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 @@ -42,9 +43,9 @@ ISSUES, WORKAROUNDS and a "ZMK-WISHLIST" #define FN 4 #define UC 5 -// personal combos and unicode setup, must come after layer shortcuts -#include "combos.dtsi" -#include "unicode.dtsi" +// combos, german and greek letters, and mouse setup +#include "mouse.dtsi" +#include "combos.dtsi" // must come after layer shortcuts // sticky key config &sk { @@ -62,11 +63,11 @@ ISSUES, WORKAROUNDS and a "ZMK-WISHLIST" /* homerow mods */ -#define LHM LM0 LM1 LM2 LM3 // left-hand HRMs +#define LHM LM4 LM3 LM2 LM1 // 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 LHK LT4 LT3 LT2 LT1 LT0 LHM LM0 LB4 LB3 LB2 LB1 LB0 // 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 +#define THK LH2 LH1 LH0 RH0 RH1 RH2 // thumb keys ZMK_BEHAVIOR(hml, hold_tap, flavor = "balanced"; diff --git a/config/combos.dtsi b/config/combos.dtsi index f0fd1da..567c1b9 100644 --- a/config/combos.dtsi +++ b/config/combos.dtsi @@ -1,73 +1,53 @@ /* KEY POSITIONS ╭─────────────────────╮ ╭─────────────────────╮ - │ LT0 LT1 LT2 LT3 LT4 │ │ RT0 RT1 RT2 RT3 RT4 │ - │ LM0 LM1 LM2 LM3 LM4 │ │ RM0 RM1 RM2 RM3 RM4 │ - │ LB0 LB1 LB2 LB3 LB4 │ │ RB0 RB1 RB2 RB3 RB4 │ - ╰───────╮ LH0 LH1 LH2 │ │ RH0 RH1 RH2 ╭───────╯ + │ LT4 LT3 LT2 LT1 LT0 │ │ RT0 RT1 RT2 RT3 RT4 │ + │ LM4 LM3 LM2 LM1 LM0 │ │ RM0 RM1 RM2 RM3 RM4 │ + │ LB4 LB3 LB2 LB1 LB0 │ │ RB0 RB1 RB2 RB3 RB4 │ + ╰───────╮ LH2 LH1 LH0 │ │ RH0 RH1 RH2 ╭───────╯ ╰─────────────╯ ╰─────────────╯ */ +// must be same for all combos to avoid #986, possibly related to #905 +#define COMBO_TERM 30 +/* Punctuation (horizontal left hand) */ +COMBO(num, &tog NUM, LT3 LT1, DEF NUM) +COMBO(all, &kp LC(A), LT3 LT2, DEF NUM) +COMBO(app, &kp LG(SPACE), LT2 LT1, DEF NUM) -// must be same to avoid #986, possibly related to #905 -#define COMBO_TERM_H 30 -#define COMBO_TERM_V 30 +COMBO(excl, &kp EXCL, LM3 LM2, DEF NUM) +COMBO(qmark, &kp QMARK, LM2 LM1, DEF NUM) -#define COMBO(NAME, BINDINGS, KEYPOS, LAYERS, TERM) \ - combo_##NAME { \ - timeout-ms = ; \ - bindings = ; \ - key-positions = ; \ - layers = ; \ - }; +COMBO(cut, &kp LC(X), LB3 LB1, DEF NUM) +COMBO(copy, &kp LC(INS), LB3 LB2, DEF NUM) +COMBO(paste, &kp LS(INS), LB2 LB1, DEF NUM) -/ { - combos { - compatible = "zmk,combos"; +/* Brackets (horizontal right hand) */ +COMBO(lbrc, &kp LBRC, RT1 RT2, DEF NUM) +COMBO(rbrc, &kp RBRC, RT2 RT3, DEF NUM) +COMBO(lpar, &kp LPAR, RM1 RM2, DEF NUM) +COMBO(rpar, &kp RPAR, RM2 RM3, DEF NUM) +COMBO(lbrk, &kp LBKT, RB1 RB2, DEF NUM) +COMBO(rbrk, &kp RBKT, RB2 RB3, DEF NUM) - /* Capsword */ - // COMBO(cpwrd, &caps_word, LM3 RM1, DEF NUM, COMBO_TERM_V) +/* Other symbols (vertical combos) */ +COMBO(at, &kp AT, LT3 LM3, DEF NUM) +COMBO(hash, &kp HASH, LT2 LM2, DEF NUM) +COMBO(dllr, &kp DLLR, LT1 LM1, DEF NUM) +COMBO(prcnt, &kp PRCNT, LT0 LM0, DEF NUM) - /* Punctuation (horizontal left hand) */ - COMBO(num, &tog NUM, LT1 LT3, DEF NUM, COMBO_TERM_H) - COMBO(all, &kp LC(A), LT1 LT2, DEF NUM, COMBO_TERM_H) - COMBO(app, &kp LG(SPACE), LT2 LT3, DEF NUM, COMBO_TERM_H) +COMBO(caret, &kp CARET, RT0 RM0, DEF NUM) +COMBO(plus, &kp PLUS, RT1 RM1, DEF NUM) +COMBO(star, &kp STAR, RT2 RM2, DEF NUM) +COMBO(amps, &kp AMPS, RT3 RM3, DEF NUM) - COMBO(excl, &kp EXCL, LM1 LM2, DEF NUM, COMBO_TERM_H) - COMBO(qmark, &kp QMARK, LM2 LM3, DEF NUM, COMBO_TERM_H) +COMBO(grave, &kp GRAVE, LM3 LB3, DEF NUM) +COMBO(bslh, &kp BSLH, LM2 LB2, DEF NUM) +COMBO(tilde, &kp TILDE, LM1 LB1, DEF NUM) +COMBO(equal, &kp EQUAL, LM0 LB0, DEF NUM) - COMBO(cut, &kp LC(X), LB1 LB3, DEF NUM, COMBO_TERM_H) - COMBO(copy, &kp LC(INS), LB1 LB2, DEF NUM, COMBO_TERM_H) - COMBO(paste, &kp LS(INS), LB2 LB3, DEF NUM, COMBO_TERM_H) +COMBO(under, &kp UNDER, RM0 RB0, DEF NUM) +COMBO(minus, &kp MINUS, RM1 RB1, DEF NUM) +COMBO(fslh, &kp FSLH, RM2 RB2, DEF NUM) +COMBO(pipe, &kp PIPE, RM3 RB3, DEF NUM) - /* Brackets (horizontal right hand) */ - COMBO(lbrc, &kp LBRC, RT1 RT2, DEF NUM, COMBO_TERM_H) - COMBO(rbrc, &kp RBRC, RT2 RT3, DEF NUM, COMBO_TERM_H) - COMBO(lpar, &kp LPAR, RM1 RM2, DEF NUM, COMBO_TERM_H) - COMBO(rpar, &kp RPAR, RM2 RM3, DEF NUM, COMBO_TERM_H) - COMBO(lbrk, &kp LBKT, RB1 RB2, DEF NUM, COMBO_TERM_H) - COMBO(rbrk, &kp RBKT, RB2 RB3, DEF NUM, COMBO_TERM_H) - - /* Other symbols (vertical combos) */ - COMBO(at, &kp AT, LT1 LM1, DEF NUM, COMBO_TERM_V) - COMBO(hash, &kp HASH, LT2 LM2, DEF NUM, COMBO_TERM_V) - COMBO(dllr, &kp DLLR, LT3 LM3, DEF NUM, COMBO_TERM_V) - COMBO(prcnt, &kp PRCNT, LT4 LM4, DEF NUM, COMBO_TERM_V) - - COMBO(caret, &kp CARET, RT0 RM0, DEF NUM, COMBO_TERM_V) - COMBO(plus, &kp PLUS, RT1 RM1, DEF NUM, COMBO_TERM_V) - COMBO(star, &kp STAR, RT2 RM2, DEF NUM, COMBO_TERM_V) - COMBO(amps, &kp AMPS, RT3 RM3, DEF NUM, COMBO_TERM_V) - - COMBO(grave, &kp GRAVE, LM1 LB1, DEF NUM, COMBO_TERM_V) - COMBO(bslh, &kp BSLH, LM2 LB2, DEF NUM, COMBO_TERM_V) - COMBO(tilde, &kp TILDE, LM3 LB3, DEF NUM, COMBO_TERM_V) - COMBO(equal, &kp EQUAL, LM4 LB4, DEF NUM, COMBO_TERM_V) - - COMBO(under, &kp UNDER, RM0 RB0, DEF NUM, COMBO_TERM_V) - COMBO(minus, &kp MINUS, RM1 RB1, DEF NUM, COMBO_TERM_V) - COMBO(fslh, &kp FSLH, RM2 RB2, DEF NUM, COMBO_TERM_V) - COMBO(pipe, &kp PIPE, RM3 RB3, DEF NUM, COMBO_TERM_V) - - }; -}; diff --git a/config/planck_rev6.keymap b/config/planck_rev6.keymap index e69ac85..191cf7b 100644 --- a/config/planck_rev6.keymap +++ b/config/planck_rev6.keymap @@ -1,62 +1,10 @@ -/* KEY POSITIONS +/* source keypos definitions */ +#include "../zmk-nodefree-config/keypos_def/keypos_48keys_wide.h" - ╭────────────────────╮ ╭────────╮ ╭────────────────────╮ - │ 0 1 2 3 4 │ │ 5 6 │ │ 7 8 9 10 11 │ - │ 12 13 14 15 16 │ │ 17 18 │ │ 19 20 21 22 23 │ - │ 24 25 26 27 28 │ │ 29 30 │ │ 31 32 33 34 35 │ - │ 36 37 38 39 40 │ │ 41 42 │ │ 43 44 45 46 47 │ - ╰────────────────────╯ ╰────────╯ ╰────────────────────╯ */ - - -/* key positions */ -#define LT0 0 // left-top row -#define LT1 1 -#define LT2 2 -#define LT3 3 -#define LT4 4 - -#define RT0 7 // right-top row -#define RT1 8 -#define RT2 9 -#define RT3 10 -#define RT4 11 - -#define LM0 12 // left-middle row -#define LM1 13 -#define LM2 14 -#define LM3 15 -#define LM4 16 - -#define RM0 19 // right-middle row -#define RM1 20 -#define RM2 21 -#define RM3 22 -#define RM4 23 - -#define LB0 24 // left-bottom row -#define LB1 25 -#define LB2 26 -#define LB3 27 -#define LB4 28 - -#define RB0 31 // right-bottom row -#define RB1 32 -#define RB2 33 -#define RB3 34 -#define RB4 35 - -#define LH0 38 // left thumb keys -#define LH1 39 -#define LH2 40 - -#define RH0 43 // right thumb keys -#define RH1 44 -#define RH2 45 - -/* extra keys */ -#define EXTRA_MID &none &none -#define EXTRA_BOT_L &none &kp LGUI -#define EXTRA_BOT_R &mwh SCROLL_DOWN &mwh SCROLL_UP +/* 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 /* source the main keymap */ #include "base.keymap" diff --git a/config/unicode.dtsi b/config/unicode.dtsi deleted file mode 100644 index e6307c5..0000000 --- a/config/unicode.dtsi +++ /dev/null @@ -1,72 +0,0 @@ -/* OS specific sequence to initialize/end unicode input */ -#define OS_LEAD &kp RALT &kp U // Windows (requires WinCompose) -#define OS_TRAIL &kp RET - -/* Preprocessor macros */ -#define STRINGIFY(s) #s -#define UC_MACRO(NAME, UNICODE_BINDING) \ - macros { \ - NAME: NAME { \ - compatible = "zmk,behavior-macro"; \ - label = STRINGIFY(ZM_ ## NAME); \ - wait-ms = <0>; \ - tap-ms = <1>; \ - #binding-cells = <0>; \ - bindings = ; \ - }; \ - }; - -#define UC_MODMORPH(NAME, BINDING, SHIFTED_BINDING) \ - behaviors { \ - NAME: NAME { \ - compatible = "zmk,behavior-mod-morph"; \ - label = STRINGIFY(MM_ ## NAME); \ - #binding-cells = <0>; \ - bindings = , ; \ - mods = <(MOD_LSFT|MOD_RSFT)>; \ - masked_mods = <(MOD_LSFT|MOD_RSFT)>; \ - }; \ - }; - -#define UNICODE_SINGLE(NAME, L0, L1, L2, L3) \ - UC_MACRO(uc_lower_ ## NAME, &kp L0 &kp L1 &kp L2 &kp L3) \ - UC_MODMORPH(uc_ ## NAME, &uc_lower_ ## NAME, &none) - -#define UNICODE_PAIR(NAME, L0, L1, L2, L3, U0, U1, U2, U3) \ - UC_MACRO(uc_lower_ ## NAME, &kp L0 &kp L1 &kp L2 &kp L3) \ - UC_MACRO(uc_upper_ ## NAME, &kp U0 &kp U1 &kp U2 &kp U3) \ - UC_MODMORPH(uc_ ## NAME, &uc_lower_ ## NAME, &uc_upper_ ## NAME) - -/* User definitions */ -/ { - - UNICODE_SINGLE( alpha, N0, N3, B, N1) - UNICODE_SINGLE( beta, N0, N3, B, N2) - UNICODE_PAIR( gamma, N0, N3, B, N3, N0, N3, N9, N3) - UNICODE_PAIR( delta, N0, N3, B, N4, N0, N3, N9, N4) - UNICODE_SINGLE( epsilon, N0, N3, F, N5) // varepsilon = 03B5 - UNICODE_SINGLE( zeta, N0, N3, B, N6) - UNICODE_SINGLE( eta, N0, N3, B, N7) - UNICODE_PAIR( theta, N0, N3, B, N8, N0, N3, N9, N8) - UNICODE_SINGLE( iota, N0, N3, B, N9) - UNICODE_SINGLE( kappa, N0, N3, B, A) - UNICODE_PAIR( lambda, N0, N3, B, B, N0, N3, N9, B) - UNICODE_SINGLE( mu, N0, N3, B, C) - UNICODE_SINGLE( nu, N0, N3, B, D) - UNICODE_PAIR( xi, N0, N3, B, E, N0, N3, N9, E) - UNICODE_PAIR( pi, N0, N3, C, N0, N0, N3, A, N0) - UNICODE_SINGLE( rho, N0, N3, C, N1) - UNICODE_PAIR( sigma, N0, N3, C, N3, N0, N3, A, N3) - UNICODE_SINGLE( tau, N0, N3, C, N4) - UNICODE_PAIR( upsilon, N0, N3, C, N5, N0, N3, A, N5) - UNICODE_PAIR( phi, N0, N3, C, N6, N0, N3, A, N6) // varphi = 03C6 - UNICODE_SINGLE( chi, N0, N3, C, N7) - UNICODE_PAIR( psi, N0, N3, C, N8, N0, N3, A, N8) - UNICODE_PAIR( omega, N0, N3, C, N9, N0, N3, A, N9) - - UNICODE_PAIR( ae, N0, N0, E, N4, N0, N0, C, N4) - UNICODE_PAIR( oe, N0, N0, F, N6, N0, N0, D, N6) - UNICODE_PAIR( ue, N0, N0, F, C, N0, N0, D, C) - UNICODE_SINGLE( eszett, N0, N0, D, F) - -}; diff --git a/zmk-nodefree-config/README.md b/zmk-nodefree-config/README.md index 262080c..fd98643 100644 --- a/zmk-nodefree-config/README.md +++ b/zmk-nodefree-config/README.md @@ -10,11 +10,11 @@ streamlined syntax. Check out [example.keymap](example.keymap) to see it in acti ## Usage overview -1. Copy the file `helper.dtsi` from this repository into the "config" folder of your +1. Copy the file `helper.h` from this repository into the "config" folder of your private zmk-config repository -2. Source `helper.dtsi` near the top of your `.keymap` file: +2. Source `helper.h` near the top of your `.keymap` file: ```C++ - #include "helper.dtsi" + #include "helper.h" ``` 3. Customize your keyboard's `.keymap` file. See [example.keymap](example.keymap) or [my personal zmk-config](https://github.com/urob/zmk-config/blob/main/config/base.keymap) @@ -22,7 +22,7 @@ streamlined syntax. Check out [example.keymap](example.keymap) to see it in acti ## Usage details -`helper.dtsi` provides two convenience macros. `ZMK_BEHAVIOR` creates new behaviors, and +`helper.h` provides two convenience macros. `ZMK_BEHAVIOR` creates new behaviors, and `ZMK_LAYER` adds new layers to your keymap. ### ZMK\_BEHAVIOR diff --git a/zmk-nodefree-config/example.keymap b/zmk-nodefree-config/example.keymap index ae75ff3..e02633b 100644 --- a/zmk-nodefree-config/example.keymap +++ b/zmk-nodefree-config/example.keymap @@ -1,6 +1,6 @@ #include #include -#include "helper.dtsi" +#include "helper.h" /* layer and key shortcuts */ diff --git a/zmk-nodefree-config/helper.dtsi b/zmk-nodefree-config/helper.dtsi deleted file mode 100644 index 2814074..0000000 --- a/zmk-nodefree-config/helper.dtsi +++ /dev/null @@ -1,32 +0,0 @@ -/* helper.dtsi: convenience macros simplifying ZMK's keymap configuration */ - -#define ZMK_HELPER_CORE_caps_word compatible = "zmk,behavior-caps-word"; #binding-cells = <0> -#define ZMK_HELPER_CORE_hold_tap compatible = "zmk,behavior-hold-tap"; #binding-cells = <2> -#define ZMK_HELPER_CORE_key_repeat compatible = "zmk,behavior-key-repeat"; #binding-cells = <0> -#define ZMK_HELPER_CORE_macro compatible = "zmk,behavior-macro"; #binding-cells = <0> -#define ZMK_HELPER_CORE_mod_morph compatible = "zmk,behavior-mod-morph"; #binding-cells = <0> -#define ZMK_HELPER_CORE_sticky_key compatible = "zmk,behavior-sticky-key"; #binding-cells = <1> -#define ZMK_HELPER_CORE_tap_dance compatible = "zmk,behavior-tap-dance"; #binding-cells = <0> - -#define ZMK_BEHAVIOR_STRINGIFY(x) #x -#define ZMK_BEHAVIOR(name, type, ...) \ - / { \ - behaviors { \ - name: name { \ - label = ZMK_BEHAVIOR_STRINGIFY(ZB_ ## name); \ - ZMK_HELPER_CORE_ ## type; \ - __VA_ARGS__ \ - }; \ - }; \ - }; - -#define ZMK_LAYER(name, layout) \ - / { \ - keymap { \ - compatible = "zmk,keymap"; \ - name { \ - bindings = ; \ - }; \ - }; \ - }; - diff --git a/zmk-nodefree-config/helper.h b/zmk-nodefree-config/helper.h new file mode 100644 index 0000000..7e4d77f --- /dev/null +++ b/zmk-nodefree-config/helper.h @@ -0,0 +1,122 @@ +/* + * helper.h + * + * Convenience macros simplifying ZMK's keymap configuration. + * See https://github.com/urob/zmk-nodefree-config for documentation. + */ + +#pragma once + +#define ZMK_HELPER_STRINGIFY(x) #x + +/* ZMK_BEHAVIOR */ + +#define ZMK_BEHAVIOR_CORE_caps_word compatible = "zmk,behavior-caps-word"; #binding-cells = <0> +#define ZMK_BEHAVIOR_CORE_hold_tap compatible = "zmk,behavior-hold-tap"; #binding-cells = <2> +#define ZMK_BEHAVIOR_CORE_key_repeat compatible = "zmk,behavior-key-repeat"; #binding-cells = <0> +#define ZMK_BEHAVIOR_CORE_macro compatible = "zmk,behavior-macro"; #binding-cells = <0> +#define ZMK_BEHAVIOR_CORE_mod_morph compatible = "zmk,behavior-mod-morph"; #binding-cells = <0> +#define ZMK_BEHAVIOR_CORE_sticky_key compatible = "zmk,behavior-sticky-key"; #binding-cells = <1> +#define ZMK_BEHAVIOR_CORE_tap_dance compatible = "zmk,behavior-tap-dance"; #binding-cells = <0> + +#define ZMK_BEHAVIOR(name, type, ...) \ + / { \ + behaviors { \ + name: name { \ + label = ZMK_HELPER_STRINGIFY(ZB_ ## name); \ + ZMK_BEHAVIOR_CORE_ ## type; \ + __VA_ARGS__ \ + }; \ + }; \ + }; + +/* ZMK_LAYER */ + +#define ZMK_LAYER(name, layout) \ + / { \ + keymap { \ + compatible = "zmk,keymap"; \ + name { \ + bindings = ; \ + }; \ + }; \ + }; + +/* ZMK_COMBOS */ + +#define ALL -1 +#if !defined COMBO_TERM + #define COMBO_TERM 30 +#endif + +#define COMBO(name, combo_bindings, keypos, combo_layers) \ + / { \ + combos { \ + compatible = "zmk,combos"; \ + combo_ ## name { \ + timeout-ms = ; \ + bindings = ; \ + key-positions = ; \ + layers = ; \ + }; \ + }; \ + }; + +/* ZMK_UNICODE */ + +#if !defined OS_COMBO_LEAD + #if HOST_OS == 2 + // OSx + #elif HOST_OS == 1 + // Linux + #else + #define OS_COMBO_LEAD &kp RALT &kp U // Windows + WinCompose (default) + #endif +#endif +#if !defined OS_COMBO_TRAIL + #if HOST_OS == 2 + // OSx + #elif HOST_OS == 1 + // Linux + #else + #define OS_COMBO_TRAIL &kp RET // Windows + WinCompose (default) + #endif +#endif + +#define UC_MACRO(name, unicode_bindings) \ + / { \ + macros { \ + name: name { \ + compatible = "zmk,behavior-macro"; \ + label = ZMK_HELPER_STRINGIFY(UC_MACRO_ ## name); \ + wait-ms = <0>; \ + tap-ms = <1>; \ + #binding-cells = <0>; \ + bindings = , , ; \ + }; \ + }; \ + }; + +#define UC_MODMORPH(name, uc_binding, shifted_uc_binding) \ + / { \ + behaviors { \ + name: name { \ + compatible = "zmk,behavior-mod-morph"; \ + label = ZMK_HELPER_STRINGIFY(UC_MORPH_ ## name); \ + #binding-cells = <0>; \ + bindings = , ; \ + mods = <(MOD_LSFT|MOD_RSFT)>; \ + masked_mods = <(MOD_LSFT|MOD_RSFT)>; \ + }; \ + }; \ + }; + +#define ZMK_UNICODE_SINGLE(name, L0, L1, L2, L3) \ + UC_MACRO(uc_lower_ ## name, &kp L0 &kp L1 &kp L2 &kp L3) \ + UC_MODMORPH(uc_ ## name, &uc_lower_ ## name, &none) + +#define ZMK_UNICODE_PAIR(name, L0, L1, L2, L3, U0, U1, U2, U3) \ + UC_MACRO(uc_lower_ ## name, &kp L0 &kp L1 &kp L2 &kp L3) \ + UC_MACRO(uc_upper_ ## name, &kp U0 &kp U1 &kp U2 &kp U3) \ + UC_MODMORPH(uc_ ## name, &uc_lower_ ## name, &uc_upper_ ## name) + diff --git a/zmk-nodefree-config/international_chars/german.dtsi b/zmk-nodefree-config/international_chars/german.dtsi new file mode 100644 index 0000000..bce8776 --- /dev/null +++ b/zmk-nodefree-config/international_chars/german.dtsi @@ -0,0 +1,6 @@ +/* German umlauts */ +ZMK_UNICODE_PAIR( ae, N0, N0, E, N4, N0, N0, C, N4) +ZMK_UNICODE_PAIR( oe, N0, N0, F, N6, N0, N0, D, N6) +ZMK_UNICODE_PAIR( ue, N0, N0, F, C, N0, N0, D, C) +ZMK_UNICODE_SINGLE( eszett, N0, N0, D, F) + diff --git a/zmk-nodefree-config/international_chars/greek.dtsi b/zmk-nodefree-config/international_chars/greek.dtsi new file mode 100644 index 0000000..afcc970 --- /dev/null +++ b/zmk-nodefree-config/international_chars/greek.dtsi @@ -0,0 +1,25 @@ +/* Greek letters */ +ZMK_UNICODE_PAIR( alpha, N0, N3, B, N1, N0, N3, N9, N1) +ZMK_UNICODE_PAIR( beta, N0, N3, B, N2, N0, N3, N9, N2) +ZMK_UNICODE_PAIR( gamma, N0, N3, B, N3, N0, N3, N9, N3) +ZMK_UNICODE_PAIR( delta, N0, N3, B, N4, N0, N3, N9, N4) +ZMK_UNICODE_PAIR( epsilon, N0, N3, F, N5, N0, N3, N9, N5) // varepsilon = 03B5 +ZMK_UNICODE_PAIR( zeta, N0, N3, B, N6, N0, N3, N9, N6) +ZMK_UNICODE_PAIR( eta, N0, N3, B, N7, N0, N3, N9, N7) +ZMK_UNICODE_PAIR( theta, N0, N3, B, N8, N0, N3, N9, N8) +ZMK_UNICODE_PAIR( iota, N0, N3, B, N9, N0, N3, N9, N9) +ZMK_UNICODE_PAIR( kappa, N0, N3, B, A, N0, N3, N9, A) +ZMK_UNICODE_PAIR( lambda, N0, N3, B, B, N0, N3, N9, B) +ZMK_UNICODE_PAIR( mu, N0, N3, B, C, N0, N3, N9, C) +ZMK_UNICODE_PAIR( nu, N0, N3, B, D, N0, N3, N9, D) +ZMK_UNICODE_PAIR( xi, N0, N3, B, E, N0, N3, N9, E) +ZMK_UNICODE_PAIR( pi, N0, N3, C, N0, N0, N3, A, N0) +ZMK_UNICODE_PAIR( rho, N0, N3, C, N1, N0, N3, A, N1) +ZMK_UNICODE_PAIR( sigma, N0, N3, C, N3, N0, N3, A, N3) +ZMK_UNICODE_PAIR( tau, N0, N3, C, N4, N0, N3, A, N4) +ZMK_UNICODE_PAIR( upsilon, N0, N3, C, N5, N0, N3, A, N5) +ZMK_UNICODE_PAIR( phi, N0, N3, C, N6, N0, N3, A, N6) // varphi = 03C6 +ZMK_UNICODE_PAIR( chi, N0, N3, C, N7, N0, N3, A, N7) +ZMK_UNICODE_PAIR( psi, N0, N3, C, N8, N0, N3, A, N8) +ZMK_UNICODE_PAIR( omega, N0, N3, C, N9, N0, N3, A, N9) + diff --git a/zmk-nodefree-config/keypos_def/keypos_34keys.h b/zmk-nodefree-config/keypos_def/keypos_34keys.h new file mode 100644 index 0000000..f7f1a6e --- /dev/null +++ b/zmk-nodefree-config/keypos_def/keypos_34keys.h @@ -0,0 +1,53 @@ +/* 34 KEY MATRIX / LAYOUT MAPPING + + ╭────────────────────┬────────────────────╮ ╭─────────────────────┬─────────────────────╮ + │ 0 1 2 3 4 │ 5 6 7 8 9 │ │ LT4 LT3 LT2 LT1 LT0 │ RT0 RT1 RT2 RT3 RT4 │ + │ 10 11 12 13 14 │ 15 16 17 18 19 │ │ LM4 LM3 LM2 LM1 LM0 │ RM0 RM1 RM2 RM3 RM4 │ + │ 20 21 22 23 24 │ 25 26 27 28 29 │ │ LB4 LB3 LB2 LB1 LB0 │ RB0 RB1 RB2 RB3 RB4 │ + ╰───────────╮ 30 31 │ 32 33 ╭───────────╯ ╰───────────╮ LH1 LH0 │ RH0 RH1 ╭───────────╯ + ╰────────┴────────╯ ╰─────────┴─────────╯ */ + +#pragma once + +#define LT0 4 // left-top row +#define LT1 3 +#define LT2 2 +#define LT3 1 +#define LT4 0 + +#define RT0 5 // right-top row +#define RT1 6 +#define RT2 7 +#define RT3 8 +#define RT4 9 + +#define LM0 14 // left-middle row +#define LM1 13 +#define LM2 12 +#define LM3 11 +#define LM4 10 + +#define RM0 15 // right-middle row +#define RM1 16 +#define RM2 17 +#define RM3 18 +#define RM4 19 + +#define LB0 24 // left-bottom row +#define LB1 23 +#define LB2 22 +#define LB3 21 +#define LB4 20 + +#define RB0 25 // right-bottom row +#define RB1 26 +#define RB2 27 +#define RB3 28 +#define RB4 29 + +#define LH0 31 // left thumb keys +#define LH1 30 + +#define RH0 32 // right thumb keys +#define RH1 33 + diff --git a/zmk-nodefree-config/keypos_def/keypos_36keys.h b/zmk-nodefree-config/keypos_def/keypos_36keys.h new file mode 100644 index 0000000..6bf73c1 --- /dev/null +++ b/zmk-nodefree-config/keypos_def/keypos_36keys.h @@ -0,0 +1,55 @@ +/* 36 KEY MATRIX / LAYOUT MAPPING + + ╭────────────────────┬────────────────────╮ ╭─────────────────────┬─────────────────────╮ + │ 0 1 2 3 4 │ 5 6 7 8 9 │ │ LT4 LT3 LT2 LT1 LT0 │ RT0 RT1 RT2 RT3 RT4 │ + │ 10 11 12 13 14 │ 15 16 17 18 19 │ │ LM4 LM3 LM2 LM1 LM0 │ RM0 RM1 RM2 RM3 RM4 │ + │ 20 21 22 23 24 │ 25 26 27 28 29 │ │ LB4 LB3 LB2 LB1 LB0 │ RB0 RB1 RB2 RB3 RB4 │ + ╰───────╮ 30 31 32 │ 33 34 35 ╭───────╯ ╰───────╮ LH2 LH1 LH0 │ RH0 RH1 RH2 ╭───────╯ + ╰────────────┴────────────╯ ╰─────────────┴─────────────╯ */ + +#pragma once + +#define LT0 4 // left-top row +#define LT1 3 +#define LT2 2 +#define LT3 1 +#define LT4 0 + +#define RT0 5 // right-top row +#define RT1 6 +#define RT2 7 +#define RT3 8 +#define RT4 9 + +#define LM0 14 // left-middle row +#define LM1 13 +#define LM2 12 +#define LM3 11 +#define LM4 10 + +#define RM0 15 // right-middle row +#define RM1 16 +#define RM2 17 +#define RM3 18 +#define RM4 19 + +#define LB0 24 // left-bottom row +#define LB1 23 +#define LB2 22 +#define LB3 21 +#define LB4 20 + +#define RB0 25 // right-bottom row +#define RB1 26 +#define RB2 27 +#define RB3 28 +#define RB4 29 + +#define LH0 32 // left thumb keys +#define LH1 31 +#define LH2 30 + +#define RH0 33 // right thumb keys +#define RH1 34 +#define RH2 35 + diff --git a/zmk-nodefree-config/keypos_def/keypos_42keys.h b/zmk-nodefree-config/keypos_def/keypos_42keys.h new file mode 100644 index 0000000..f2ad1aa --- /dev/null +++ b/zmk-nodefree-config/keypos_def/keypos_42keys.h @@ -0,0 +1,61 @@ +/* 42 KEY MATRIX / LAYOUT MAPPING + + ╭────────────────────────┬────────────────────────╮ ╭─────────────────────────┬─────────────────────────╮ + │ 0 1 2 3 4 5 │ 6 7 8 9 10 11 │ │ LT5 LT4 LT3 LT2 LT1 LT0 │ RT0 RT1 RT2 RT3 RT4 RT5 │ + │ 12 13 14 15 16 17 │ 18 19 20 21 22 23 │ │ LM5 LM4 LM3 LM2 LM1 LM0 │ RM0 RM1 RM2 RM3 RM4 RM5 │ + │ 24 25 26 27 28 29 │ 30 31 32 33 34 35 │ │ LB5 LB4 LB3 LB2 LB1 LB0 │ RB0 RB1 RB2 RB3 RB4 RB5 │ + ╰───────────╮ 36 37 38 │ 39 40 41 ╭───────────╯ ╰───────────╮ LH2 LH1 LH0 │ RH0 RH1 RH2 ╭───────────╯ + ╰────────────┴────────────╯ ╰─────────────┴─────────────╯ */ + +#pragma once + +#define LT0 5 // left-top row +#define LT1 4 +#define LT2 3 +#define LT3 2 +#define LT4 1 +#define LT5 0 + +#define RT0 6 // right-top row +#define RT1 7 +#define RT2 8 +#define RT3 9 +#define RT4 10 +#define RT5 11 + +#define LM0 17 // left-middle row +#define LM1 16 +#define LM2 15 +#define LM3 14 +#define LM4 13 +#define LM5 12 + +#define RM0 18 // right-middle row +#define RM1 19 +#define RM2 20 +#define RM3 21 +#define RM4 22 +#define RM5 23 + +#define LB0 29 // left-bottom row +#define LB1 28 +#define LB2 27 +#define LB3 26 +#define LB4 25 +#define LB5 24 + +#define RB0 30 // right-bottom row +#define RB1 31 +#define RB2 32 +#define RB3 33 +#define RB4 34 +#define RB5 35 + +#define LH0 38 // left thumb keys +#define LH1 37 +#define LH2 36 + +#define RH0 39 // right thumb keys +#define RH1 40 +#define RH2 41 + diff --git a/zmk-nodefree-config/keypos_def/keypos_48keys.h b/zmk-nodefree-config/keypos_def/keypos_48keys.h new file mode 100644 index 0000000..3c171f0 --- /dev/null +++ b/zmk-nodefree-config/keypos_def/keypos_48keys.h @@ -0,0 +1,67 @@ +/* 48 KEY MATRIX / LAYOUT MAPPING + + ╭────────────────────────┬────────────────────────╮ ╭─────────────────────────┬─────────────────────────╮ + │ 0 1 2 3 4 5 │ 6 7 8 9 10 11 │ │ LT5 LT4 LT3 LT2 LT1 LT0 │ RT0 RT1 RT2 RT3 RT4 RT5 │ + │ 12 13 14 15 16 17 │ 18 19 20 21 22 23 │ │ LM5 LM4 LM3 LM2 LM1 LM0 │ RM0 RM1 RM2 RM3 RM4 RM5 │ + │ 24 25 26 27 28 29 │ 30 31 32 33 34 35 │ │ LB5 LB4 LB3 LB2 LB1 LB0 │ RB0 RB1 RB2 RB3 RB4 RB5 │ + │ 36 37 38 39 40 41 │ 42 43 44 45 46 47 │ │ LH5 LH4 LH3 LH2 LH1 LH0 │ RH0 RH1 RH2 RH3 RH4 RH5 │ + ╰────────────────────────┴────────────────────────╯ ╰─────────────────────────┴─────────────────────────╯ */ + +#pragma once + +#define LT0 5 // left-top row +#define LT1 4 +#define LT2 3 +#define LT3 2 +#define LT4 1 +#define LT5 0 + +#define RT0 6 // right-top row +#define RT1 7 +#define RT2 8 +#define RT3 9 +#define RT4 10 +#define RT5 11 + +#define LM0 17 // left-middle row +#define LM1 16 +#define LM2 15 +#define LM3 14 +#define LM4 13 +#define LM5 12 + +#define RM0 18 // right-middle row +#define RM1 19 +#define RM2 20 +#define RM3 21 +#define RM4 22 +#define RM5 23 + +#define LB0 29 // left-bottom row +#define LB1 28 +#define LB2 27 +#define LB3 26 +#define LB4 25 +#define LB5 24 + +#define RB0 30 // right-bottom row +#define RB1 31 +#define RB2 32 +#define RB3 33 +#define RB4 34 +#define RB5 35 + +#define LH0 41 // left thumb keys +#define LH1 40 +#define LH2 39 +#define LH3 38 +#define LH4 37 +#define LH5 36 + +#define RH0 42 // right thumb keys +#define RH1 43 +#define RH2 44 +#define RH3 45 +#define RH4 46 +#define RH5 47 + diff --git a/zmk-nodefree-config/keypos_def/keypos_48keys_wide.h b/zmk-nodefree-config/keypos_def/keypos_48keys_wide.h new file mode 100644 index 0000000..73d7e30 --- /dev/null +++ b/zmk-nodefree-config/keypos_def/keypos_48keys_wide.h @@ -0,0 +1,59 @@ +/* 48 KEY MATRIX / WIDE LAYOUT MAPPING + + ╭────────────────────────┬────────────────────────╮ ╭─────────────────────────┬─────────────────────────╮ + │ 0 1 2 3 4 5 │ 6 7 8 9 10 11 │ │ LT4 LT3 LT2 LT1 LT0 --- │ --- RT0 RT1 RT2 RT3 RT4 │ + │ 12 13 14 15 16 17 │ 18 19 20 21 22 23 │ │ LM4 LM3 LM2 LM1 LM0 --- │ --- RM0 RM1 RM2 RM3 RM4 │ + │ 24 25 26 27 28 29 │ 30 31 32 33 34 35 │ │ LB4 LB3 LB2 LB1 LB0 --- │ --- RB0 RB1 RB2 RB3 RB4 │ + │ 36 37 38 39 40 41 │ 42 43 44 45 46 47 │ │ LH4 LH3 LH2 LH1 LH0 --- │ --- RH0 RH1 RH2 RH3 RH4 │ + ╰────────────────────────┴────────────────────────╯ ╰─────────────────────────┴─────────────────────────╯ */ + +#pragma once + +#define LT0 4 // left-top row +#define LT1 3 +#define LT2 2 +#define LT3 1 +#define LT4 0 + +#define RT0 7 // right-top row +#define RT1 8 +#define RT2 9 +#define RT3 10 +#define RT4 11 + +#define LM0 16 // left-middle row +#define LM1 15 +#define LM2 14 +#define LM3 13 +#define LM4 12 + +#define RM0 19 // right-middle row +#define RM1 20 +#define RM2 21 +#define RM3 22 +#define RM4 23 + +#define LB0 28 // left-bottom row +#define LB1 27 +#define LB2 26 +#define LB3 25 +#define LB4 24 + +#define RB0 31 // right-bottom row +#define RB1 32 +#define RB2 33 +#define RB3 34 +#define RB4 35 + +#define LH0 40 // left thumb keys +#define LH1 39 +#define LH2 38 +#define LH3 37 +#define LH4 36 + +#define RH0 43 // right thumb keys +#define RH1 44 +#define RH2 45 +#define RH3 46 +#define RH4 47 +