Update node-free repo

This commit is contained in:
urob 2022-08-05 10:41:37 -04:00
parent 444ccfd8be
commit b49fe54af9
3 changed files with 42 additions and 23 deletions

View file

@ -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 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. streamlined syntax. Check out [example.keymap](example.keymap) to see it in action.
See [changelog](#changelog) for latest changes.
## Overview ## Overview
The following convenience macros are provided: 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. 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 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 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. [issues](https://github.com/zmkfirmware/zmk/issues/905) with overlapping combos and should be avoided.
#### Example: copy and paste combos #### Example: copy and paste combos
```C++ ```C++
#undef COMBO_TERM
#define COMBO_TERM 50 #define COMBO_TERM 50
ZMK_COMBO(copy, &kp LC(C), 12 13, ALL) ZMK_COMBO(copy, &kp LC(C), 12 13, ALL)
ZMK_COMBO(paste, &kp LC(V), 13 14, 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 #### Dependencies for unicode
* `ZMK_UNICODE_PAIR` requires ZMK patched with a modified version of the "masked-mods" * `ZMK_UNICODE_PAIR` requires ZMK patched with [PR
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 #1412](https://github.com/zmkfirmware/zmk/pull/1412). If you don't want to maintain
to maintain your own ZMK repository, you can use ZMK's [beta your own ZMK repository, you can use ZMK's [beta
testing](https://zmk.dev/docs/features/beta-testing) feature to configure Github 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 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 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: projects:
- name: zmk - name: zmk
remote: urob remote: urob
revision: masked-mods revision: fix-mod-morph
import: app/west.yml import: app/west.yml
self: self:
path: config 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. 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 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 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 * 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 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 ### International characters
There are pre-defined definitions for international characters for a few 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.: loaded by sourcing the corresponding files; e.g.:
```C++ ```C++
#include "../zmk-nodefree-config/international_chars/german.dtsi" #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 Here we use ZMK's [positional
hold-tap](https://zmk.dev/docs/behaviors/hold-tap#positional-hold-tap-and-hold-trigger-key-positions) 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: key-position helpers makes this straightforward:
```C++ ```C++
@ -363,19 +366,20 @@ ZMK_BEHAVIOR(hmr, hold_tap, // right-hand HRMs
hold-trigger-key-positions = <KEYS_LT THUMBS HRM_RT>; // include right-hand HRMs for chording hold-trigger-key-positions = <KEYS_LT THUMBS HRM_RT>; // 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 <kbd>Right Alt</kbd> ## 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 <kbd>Right Alt</kbd>
followed by <kbd>U</kbd> and `OS_UNICODE_TRAIL` set to tap <kbd>Return</kbd>. followed by <kbd>U</kbd> and `OS_UNICODE_TRAIL` set to tap <kbd>Return</kbd>.
The default for Linux is `OS_UNICODE_LEAD` set to tap <kbd>Shift</kbd> + The default for Linux is `OS_UNICODE_LEAD` set to tap <kbd>Shift</kbd> +
<kbd>Ctrl</kbd> + <kbd>U</kbd> and `OS_UNICODE_TRAIL` set to tap <kbd>Space</kbd>. <kbd>Ctrl</kbd> + <kbd>U</kbd> and `OS_UNICODE_TRAIL` set to tap <kbd>Space</kbd>.
The default for macOS is `OS_UNICODE_LEAD` set to hold <kbd>Left Alt</kbd> The default for macOS is `OS_UNICODE_LEAD` set to hold <kbd>Left Alt</kbd>
and `OS_UNICODE_TRAIL` set to release <kbd>Left Alt</kbd>. and `OS_UNICODE_TRAIL` set to release <kbd>Left Alt</kbd>.
[^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.

View file

@ -51,6 +51,7 @@ ZMK_UNICODE_SINGLE(euro_sign, N2, N0, A, C) // €
ZMK_CONDITIONAL_LAYER(NAV NUM, GER) ZMK_CONDITIONAL_LAYER(NAV NUM, GER)
// combos // combos
#undef COMBO_TERM
#define COMBO_TERM 40 // timeout of 40ms (default is 30ms if omitted) #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_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 ZMK_COMBO(combo_copy, &kp LC(C), LB2 LB3, ALL) // Ctrl + C, active on all layers

View file

@ -44,24 +44,37 @@
/* ZMK_COMBOS */ /* ZMK_COMBOS */
#define ALL -1 #define ALL 0xff
#if !defined COMBO_TERM #if !defined COMBO_TERM
#define COMBO_TERM 30 #define COMBO_TERM 30
#endif #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 { \ combos { \
compatible = "zmk,combos"; \ compatible = "zmk,combos"; \
combo_ ## name { \ combo_ ## name { \
timeout-ms = <COMBO_TERM>; \
bindings = <combo_bindings>; \ bindings = <combo_bindings>; \
key-positions = <keypos>; \ key-positions = <keypos>; \
layers = <combo_layers>; \ layers = <combo_layers>; \
timeout-ms = <combo_term>; \ }; \
global-quick-tap-ms = <COMBO_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 = <combo_timeout>; \
bindings = <combo_bindings>; \
key-positions = <keypos>; \
layers = <combo_layers>; \
COMBO_ADD_ON \
}; \ }; \
}; \ }; \
}; };
@ -123,6 +136,7 @@
#binding-cells = <0>; \ #binding-cells = <0>; \
bindings = <uc_binding>, <shifted_uc_binding>; \ bindings = <uc_binding>, <shifted_uc_binding>; \
mods = <(MOD_LSFT|MOD_RSFT)>; \ mods = <(MOD_LSFT|MOD_RSFT)>; \
masked-mods = <(MOD_LSFT|MOD_RSFT)>; \
}; \ }; \
}; \ }; \
}; };