Skip to content

Commit 8661598

Browse files
committed
Add zmk-keymap-utils/hrm/timeless.dtsi
1 parent 899cc21 commit 8661598

File tree

3 files changed

+103
-1
lines changed

3 files changed

+103
-1
lines changed

README.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,13 @@ Then include any extra functionality you need:
6363

6464
```c
6565
// select-word macros based on the Sunaku's implementation of Pascal Getreuer's Select Word macro from QMK
66-
#include <zmk-keymap-utils/select_word.h>
66+
#include <zmk-keymap-utils/select_word.dtsi>
67+
// timeless home-row mods based on urob's implementation
68+
#include <zmk-keymap-utils/hrm/timeless.dtsi>
6769
```
6870

71+
## Inspiration
72+
6973
# License
7074

7175
This project is released under the [ISC License](LICENSE).
@@ -74,3 +78,9 @@ It also contains copied or modified code from other Open Sourcethird-party proje
7478

7579
- [sunaku/glove80-keymaps](https://github.com/sunaku/glove80-keymaps) for initial implementation
7680
- [urob/zmk-helpers](https://github.com/urob/zmk-helpers) is required as a module to use this project.
81+
82+
## Inspiration
83+
84+
In adition to the projects mentioned in the License, this project is inspired by other zmk-config projects and their configuration:
85+
86+
- [urob/zmk-config](https://github.com/urob/zmk-config), where it was firs described the configuration to implement [Timeless homerow mods](https://github.com/urob/zmk-config?tab=readme-ov-file#timeless-homerow-mods).

docs/README.md

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,3 +116,66 @@ The behaviors provided after import are the following:
116116

117117
> [!TIP]
118118
> The behaviors are implemented in such a way that using them with the shift modifier active selects/extends in the t
119+
120+
## Home-Row Mods
121+
122+
There are different implementations of Home-Row Mods (HRM) that are tailored to different ways of typing.
123+
A good resource to read about them is the [Precondition's Guide to Home Row Mods](https://precondition.github.io/home-row-mods).
124+
125+
Here we provide utilities for different implementations:
126+
127+
- Timeless HRM: based on [Urob's Personal zmk-config](https://github.com/urob/zmk-config/) implemenation.
128+
129+
### Timeless HRM
130+
131+
The "timeless" HRM is using basic ZMK behavior to implement HRMs that are tailored to users without not very consistent typing speeds.
132+
Basically tries to minimize misfires by being independent of any timing configuration.
133+
The `tapping-term-ms` is in practice not infinity but set by default to 175ms, which provides a way to:
134+
135+
- Combine mods with alpha-keys on the same hand
136+
- Press a modifier without another key
137+
138+
More detailed information about this implementation can be found on the [urob/zmk-config README for timeless HRM](https://github.com/urob/zmk-config?tab=readme-ov-file#timeless-homerow-mods).
139+
140+
Here we provide a basic function to define your HRM behaviors with ease.
141+
To use the default configuration, import with:
142+
143+
```c
144+
// select-word macros based on the Sunaku's implementation of Pascal Getreuer's Select Word macro from QMK
145+
#include "zmk-keymap-utils/hrm/timeless.dtsi.h"
146+
```
147+
148+
To use a different `tapping-term-ms`, the `TIMELESS_HRM_QUICK_TAP_MS` property can be used before import (default is `175`).
149+
This configuration can be tweak to support mod+alpha combinations in the same hand, and modifier press without other keys.
150+
For example:
151+
152+
```c
153+
#define TIMELESS_HRM_QUICK_TAP_MS 280
154+
#include "zmk-keymap-utils/hrm/timeless.dtsi.h"
155+
```
156+
157+
After import, you can define your HRMs using the `MAKE_TIMELESS_HRM` function.
158+
This function takes the following parameters:
159+
160+
- `NAME`: the name of the HRM-behavior.
161+
The behavior will be used on the keymap with `&NAME <mod> <alpha>` (where name is the given parameter).
162+
- `HOLD`: the behavior on hold.
163+
This is the behavior to trigger on hold, and can be a simple `&kp` (tipically) or any other complex behavior having a parameter.
164+
- `TAP`: the behavior on tap.
165+
This is the behavior to trigger on tap, and can be a simple `&kp` (tipically) or any other complex behavior having a parameter.
166+
- `TRIGGER_POS`: positions for hold-trigger-key-positions. Tipically the positions on the oposite hand from the HRM hand.
167+
168+
A clear example on how to use this function is a refactor of the [Urob's Personal zmk-config](https://github.com/urob/zmk-config/) HRM implementation using this module.
169+
170+
> [!NOTE]
171+
> This snippet uses the standard key-labels from `urob/zmk-helpers` (see [its README](https://github.com/urob/zmk-helpers?tab=readme-ov-file#key-labels-collection) for more details).
172+
173+
```c
174+
#include "zmk-helpers/key-labels/36.h" // Source key-labels.
175+
#define KEYS_L LT0 LT1 LT2 LT3 LT4 LM0 LM1 LM2 LM3 LM4 LB0 LB1 LB2 LB3 LB4 // Left-hand keys.
176+
#define KEYS_R RT0 RT1 RT2 RT3 RT4 RM0 RM1 RM2 RM3 RM4 RB0 RB1 RB2 RB3 RB4 // Right-hand keys.
177+
#define THUMBS LH2 LH1 LH0 RH0 RH1 RH2 // Thumb keys.
178+
179+
MAKE_TIMELESS_HRM(hml, &kp, &kp, KEYS_R THUMBS) // Left-hand HRMs - for example, &hml LGUI A
180+
MAKE_TIMELESS_HRM(hmr, &kp, &kp, KEYS_L THUMBS) // Right-hand HRMs - for example, &hmr LGUI O
181+
```
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/*
2+
* Adapted from urob's zmk-config repo: https://github.com/urob/zmk-config/
3+
*/
4+
5+
// defines the quick-tap to be used on timeless-homerow-mods
6+
#ifndef TIMELESS_HRM_QUICK_TAP_MS
7+
#define TIMELESS_HRM_QUICK_TAP_MS 175
8+
#endif
9+
10+
/*
11+
* Make the timeless HRM
12+
*
13+
* - NAME: the name of the HRM-behavior
14+
* - HOLD: the behavior on hold (tipically &kp)
15+
* - TAP: the behavior on tap (tipically &kp)
16+
* - TRIGGER_POS: positions for hold-trigger-key-positions
17+
*
18+
* Creates after calling a "&NAME <HOLD_KEY> <TAP_KEY>" behavior
19+
*/
20+
#define MAKE_TIMELESS_HRM(NAME, HOLD, TAP, TRIGGER_POS) \
21+
ZMK_HOLD_TAP(NAME, \
22+
bindings = <HOLD>, <TAP>; \
23+
flavor = "balanced"; \
24+
tapping-term-ms = <280>; \
25+
quick-tap-ms = <TIMELESS_HRM_QUICK_TAP_MS>; \
26+
require-prior-idle-ms = <150>; \
27+
hold-trigger-on-release; \
28+
hold-trigger-key-positions = <TRIGGER_POS>; \
29+
)

0 commit comments

Comments
 (0)