You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -320,38 +317,47 @@ The fifth cell of `BEHAVIOR_DT_INST_DEFINE` can be set to `NULL` instead if inst
320
317
Remember that `.c` files should be formatted according to `clang-format` to ensure that checks run smoothly once the pull request is submitted.
321
318
:::
322
319
320
+
### Updating `app/Kconfig.behaviors`
321
+
322
+
In order to compile the behavior only when a user includes it in their keymap, an entry needs to be added to `app/Kconfig.behaviors` similar to the entry for hold-tap, which is shown below as a reference:
323
+
324
+
```txt title="app/Kconfig.behaviors"
325
+
config ZMK_BEHAVIOR_HOLD_TAP
326
+
bool
327
+
default y
328
+
depends on DT_HAS_ZMK_BEHAVIOR_HOLD_TAP_ENABLED
329
+
```
330
+
331
+
In the case of a new behavior, replace `HOLD_TAP` with the upper-snake-cased name. If the inclusion of the behavior in a keyboard's keymap should enable a Kconfig option, append `imply ZMK_<Configuration Option>` to the entry. If the behavior requires a certain condition in a keyboard's `.conf` file to be met, append `&& ZMK_<Configuration Requirement>` to the `depends on` line.
332
+
323
333
### Updating `app/CmakeLists.txt` to include the new driver
324
334
325
-
Most behavior drivers' are invoked according to the central half's [locality](#api-structure), and are therefore stored after the line `if ((NOT CONFIG_ZMK_SPLIT) OR CONFIG_ZMK_SPLIT_ROLE_CENTRAL)` in the form, `target_sources(app PRIVATE src/behaviors/<behavior_name>.c)`, as shown below.
335
+
Most behavior drivers are invoked according to the central half's [locality](#api-structure), and are therefore stored after the line `if ((NOT CONFIG_ZMK_SPLIT) OR CONFIG_ZMK_SPLIT_ROLE_CENTRAL)` in the form, `target_sources_ifdef(CONFIG_ZMK_BEHAVIOR_<BEHAVIOR_NAME> app PRIVATE src/behaviors/<behavior_name>.c)`, as shown below.
326
336
327
337
```txt title="app/CmakeLists.txt"
328
338
if ((NOT CONFIG_ZMK_SPLIT) OR CONFIG_ZMK_SPLIT_ROLE_CENTRAL)
For behaviors that do not require central locality, the following options for updating `app/CmakeLists.txt` also exist:
350
357
351
-
- Behavior applies to unibody, or central or peripheral half of keyboard: place `target_sources(app PRIVATE <behavior_name>.c)` line _before_ `if ((NOT CONFIG_ZMK_SPLIT) OR CONFIG_ZMK_SPLIT_ROLE_CENTRAL)`
352
-
- Behavior applies to _only_ central half of split keyboard: place `target_sources(app PRIVATE <behavior_name>.c)` after `if (CONFIG_ZMK_SPLIT AND CONFIG_ZMK_SPLIT_ROLE_CENTRAL)`
353
-
- Behavior applies to _only_ peripheral half of split keyboard: place `target_sources(app PRIVATE <behavior_name>.c)` after `if (CONFIG_ZMK_SPLIT AND (NOT CONFIG_ZMK_SPLIT_ROLE_CENTRAL))`
354
-
- Behavior requires certain condition in a keyboard's `.conf` file to be met: use `target_sources_ifdef(CONFIG_<Configuration Requirement> app PRIVATE <behavior_name>.c)` instead of `target_sources(<behavior_name>.c)`
358
+
- Behavior applies to unibody, or central or peripheral half of keyboard: place `target_sources_ifdef(CONFIG_ZMK_BEHAVIOR_<BEHAVIOR_NAME> app PRIVATE src/behaviors/<behavior_name>.c)` line _before_ `if ((NOT CONFIG_ZMK_SPLIT) OR CONFIG_ZMK_SPLIT_ROLE_CENTRAL)`
359
+
- Behavior applies to _only_ central half of split keyboard: place `target_sources_ifdef(CONFIG_ZMK_BEHAVIOR_<BEHAVIOR_NAME> app PRIVATE src/behaviors/<behavior_name>.c)` after `if (CONFIG_ZMK_SPLIT AND CONFIG_ZMK_SPLIT_ROLE_CENTRAL)`
360
+
- Behavior applies to _only_ peripheral half of split keyboard: place `target_sources_ifdef(CONFIG_ZMK_BEHAVIOR_<BEHAVIOR_NAME> app PRIVATE src/behaviors/<behavior_name>.c)` after `if (CONFIG_ZMK_SPLIT AND (NOT CONFIG_ZMK_SPLIT_ROLE_CENTRAL))`
355
361
356
362
### Defining common use-cases for the behavior (`.dtsi`) (Optional)
0 commit comments