diff --git a/zmk-nodefree-config/README.md b/zmk-nodefree-config/README.md index 0229546..5575495 100644 --- a/zmk-nodefree-config/README.md +++ b/zmk-nodefree-config/README.md @@ -8,6 +8,8 @@ This repository provides simple convenience macros that simplify the configurati many common use cases. It results in a "node-free" user configuration with a more streamlined syntax. Check out [example.keymap](example.keymap) to see it in action. +See [changelog](#changelog) for latest changes. + ## Overview The following convenience macros are provided: @@ -145,13 +147,14 @@ ZMK_KEYMAP(default_layer, two layers). If set to `ALL` the combo is active on all layers. By default, the timeout for combos created with `ZMK_COMBO` is 30ms. If `COMBO_TERM` is -set prior to calling `ZMK_COMBO`, the value of `COMBO_TERM` is used instead. Note: while +reset prior to calling `ZMK_COMBO`, the new value of `COMBO_TERM` is used instead. Note: while it is possible to set different timeouts for different combos, this is known to cause [issues](https://github.com/zmkfirmware/zmk/issues/905) with overlapping combos and should be avoided. #### Example: copy and paste combos ```C++ +#undef COMBO_TERM #define COMBO_TERM 50 ZMK_COMBO(copy, &kp LC(C), 12 13, ALL) ZMK_COMBO(paste, &kp LC(V), 13 14, ALL) @@ -224,9 +227,9 @@ The creates "umlaut" pairs that can be added to the keymap using `&de_ae`, `&de_ #### Dependencies for unicode -* `ZMK_UNICODE_PAIR` requires ZMK patched with a modified version of the "masked-mods" - PR, available from [https://github.com/urob/zmk/tree/masked-mods](https://github.com/urob/zmk/tree/masked-mods).[^1] If you don't want - to maintain your own ZMK repository, you can use ZMK's [beta +* `ZMK_UNICODE_PAIR` requires ZMK patched with [PR + #1412](https://github.com/zmkfirmware/zmk/pull/1412). If you don't want to maintain + your own ZMK repository, you can use ZMK's [beta testing](https://zmk.dev/docs/features/beta-testing) feature to configure Github Actions to build against a patched remote branch of ZMK. To do so, replace the contents of `west.yml` in your `zmk-config/config` directory with the following @@ -239,7 +242,7 @@ The creates "umlaut" pairs that can be added to the keymap using `&de_ae`, `&de_ projects: - name: zmk remote: urob - revision: masked-mods + revision: fix-mod-morph import: app/west.yml self: path: config @@ -262,7 +265,7 @@ The creates "umlaut" pairs that can be added to the keymap using `&de_ae`, `&de_ This will send unicode characters using the OS's default input channels. For non-default input channels or for other operating systems, one can instead set the variables `OS_UNICODE_LEAD` and `OS_UNICODE_TRAIL` to the character sequences that - initialize/terminate the unicode input.[^2] + initialize/terminate the unicode input.[^1] * On Windows and macOS there are additional requirements for unicode input to work. On Windows, one must install [WinCompose](https://github.com/samhocevar/wincompose). On @@ -271,7 +274,7 @@ The creates "umlaut" pairs that can be added to the keymap using `&de_ae`, `&de_ ### International characters There are pre-defined definitions for international characters for a few -languages --- currently German, Greek and Swedish (contributions are welcome)[^3]. These can be +languages --- currently German, Greek and Swedish (contributions are welcome)[^2]. These can be loaded by sourcing the corresponding files; e.g.: ```C++ #include "../zmk-nodefree-config/international_chars/german.dtsi" @@ -335,7 +338,7 @@ This defines a "copy"-combo for the middle + ring finger on the left bottom row, Here we use ZMK's [positional hold-tap](https://zmk.dev/docs/behaviors/hold-tap#positional-hold-tap-and-hold-trigger-key-positions) -feature to make home-row mods only trigger with "opposite hand" keys.[^4] Using +feature to make home-row mods only trigger with "opposite hand" keys.[^3] Using key-position helpers makes this straightforward: ```C++ @@ -363,19 +366,20 @@ ZMK_BEHAVIOR(hmr, hold_tap, // right-hand HRMs hold-trigger-key-positions = ; // include right-hand HRMs for chording ) ``` -[^1]: The original "masked-mods" PR is available [here](https://github.com/zmkfirmware/zmk/pull/1114). - It works well when using the standard unicode configuration with Windows or macOS, - but leads to garbled unicode sequences under Linux. Using the patched version from - https://github.com/urob/zmk/tree/masked-mods makes it work under all three - operating systems and for non-standard configurations. -[^2]: The default for Windows is `OS_UNICODE_LEAD` set to tap Right Alt +## Changelog + +* 7/31/2022: Switch unicode dependency from PR #1114 to + [#1412](https://github.com/zmkfirmware/zmk/pull/1412) + + +[^1]: The default for Windows is `OS_UNICODE_LEAD` set to tap Right Alt followed by U and `OS_UNICODE_TRAIL` set to tap Return. The default for Linux is `OS_UNICODE_LEAD` set to tap Shift + Ctrl + U and `OS_UNICODE_TRAIL` set to tap Space. The default for macOS is `OS_UNICODE_LEAD` set to hold Left Alt and `OS_UNICODE_TRAIL` set to release Left Alt. -[^3]: Swedish language support was added by discord user "captainwoot". +[^2]: Swedish language support was added by discord user "captainwoot". -[^4]: We also whitelist same-hand HRMs so that we can combine them to chord mods. +[^3]: We also whitelist same-hand HRMs so that we can combine them to chord mods. diff --git a/zmk-nodefree-config/example.keymap b/zmk-nodefree-config/example.keymap index 0679200..d776bf2 100644 --- a/zmk-nodefree-config/example.keymap +++ b/zmk-nodefree-config/example.keymap @@ -51,6 +51,7 @@ ZMK_UNICODE_SINGLE(euro_sign, N2, N0, A, C) // € ZMK_CONDITIONAL_LAYER(NAV NUM, GER) // combos +#undef COMBO_TERM #define COMBO_TERM 40 // timeout of 40ms (default is 30ms if omitted) ZMK_COMBO(combo_sleep, &win_sleep, RT3 RT4, NAV) // custom sleep macro, only active on NAV layer ZMK_COMBO(combo_copy, &kp LC(C), LB2 LB3, ALL) // Ctrl + C, active on all layers diff --git a/zmk-nodefree-config/helper.h b/zmk-nodefree-config/helper.h index 485aa0f..34d041b 100644 --- a/zmk-nodefree-config/helper.h +++ b/zmk-nodefree-config/helper.h @@ -44,24 +44,37 @@ /* ZMK_COMBOS */ -#define ALL -1 +#define ALL 0xff #if !defined COMBO_TERM #define COMBO_TERM 30 #endif -#if !defined COMBO_QUICK_TAP_MS - #define COMBO_QUICK_TAP_MS (-1) -#endif -#define ZMK_COMBO(name, combo_bindings, keypos, combo_layers, combo_term) \ +#define ZMK_COMBO(name, combo_bindings, keypos, combo_layers) \ / { \ combos { \ compatible = "zmk,combos"; \ combo_ ## name { \ + timeout-ms = ; \ bindings = ; \ key-positions = ; \ layers = ; \ - timeout-ms = ; \ - global-quick-tap-ms = ; \ + }; \ + }; \ + }; + +#if !defined COMBO_ADD_ON + #define COMBO_ADD_ON +#endif +#define ZMK_COMBO_ADV(name, combo_bindings, keypos, combo_layers, combo_timeout) \ + / { \ + combos { \ + compatible = "zmk,combos"; \ + combo_ ## name { \ + timeout-ms = ; \ + bindings = ; \ + key-positions = ; \ + layers = ; \ + COMBO_ADD_ON \ }; \ }; \ }; @@ -123,6 +136,7 @@ #binding-cells = <0>; \ bindings = , ; \ mods = <(MOD_LSFT|MOD_RSFT)>; \ + masked-mods = <(MOD_LSFT|MOD_RSFT)>; \ }; \ }; \ };