feat(behaviors): Allow changing caps word shifted keys

Added a shift-list property to caps word to allow adding more keys to
be shifted aside from alpha keys.

Added a &prog_word behavior, which is the same as &caps_word, except it
adds MINUS to shift-list (this matches QMK's caps word behavior).

Added a no-default-keys property to caps_word, which removes the
implicit alphanumeric keys from continue-list and shift-list so you can
fully customize the lists.

Also adjusted the default continue keys to include numpad numbers,
since those are numbers too.
This commit is contained in:
Joel Spadin 2024-01-29 00:26:54 -06:00
parent 04763400a7
commit 69c7d020c9
21 changed files with 267 additions and 94 deletions

View file

@ -13,6 +13,13 @@
#binding-cells = <0>;
continue-list = <UNDERSCORE BACKSPACE DELETE>;
};
/omit-if-no-ref/ prog_word: prog_word {
compatible = "zmk,behavior-caps-word";
#binding-cells = <0>;
continue-list = <UNDERSCORE BACKSPACE DELETE>;
shift-list = <MINUS>;
};
};
};

View file

@ -11,5 +11,18 @@ properties:
continue-list:
type: array
required: true
description: |
List of key codes which should continue the caps word behavior but not have
modifiers applied when caps word is active.
Alphanumeric keys are included automatically unless no-default-keys is set.
shift-list:
type: array
description: |
List of key codes which should have modifiers applied when caps word is active.
Alpha keys are included automatically unless no-default-keys is set.
mods:
type: int
description: Bitmask of modifiers to apply. Default is MOD_LSFT.
no-default-keys:
type: boolean
description: Do not automatically include any keys in continue-list or shift-list.

View file

@ -22,10 +22,16 @@
LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL);
struct key_list {
size_t size;
struct zmk_key_param keys[];
};
struct behavior_caps_word_config {
const struct key_list *continue_keys;
const struct key_list *shift_keys;
zmk_mod_flags_t mods;
uint16_t continuations_count;
struct zmk_key_param continuations[];
bool no_default_keys;
};
struct behavior_caps_word_data {
@ -78,19 +84,13 @@ ZMK_SUBSCRIPTION(behavior_caps_word, zmk_keycode_state_changed);
static const struct device *devs[] = {LISTIFY(DEVICE_COUNT, DEVICE_INST, (, ))};
static bool caps_word_is_caps_includelist(const struct behavior_caps_word_config *config,
uint16_t usage_page, uint8_t usage_id,
uint8_t implicit_modifiers) {
for (int i = 0; i < config->continuations_count; i++) {
const struct zmk_key_param *continuation = &config->continuations[i];
LOG_DBG("Comparing with 0x%02X - 0x%02X (with implicit mods: 0x%02X)", continuation->page,
continuation->id, continuation->modifiers);
static bool key_list_contains(const struct key_list *list, uint16_t usage_page, zmk_key_t usage_id,
zmk_mod_flags_t modifiers) {
for (int i = 0; i < list->size; i++) {
const struct zmk_key_param *key = &list->keys[i];
if (continuation->page == usage_page && continuation->id == usage_id &&
(continuation->modifiers & (implicit_modifiers | zmk_hid_get_explicit_mods())) ==
continuation->modifiers) {
LOG_DBG("Continuing capsword, found included usage: 0x%02X - 0x%02X", usage_page,
usage_id);
if (key->page == usage_page && key->id == usage_id &&
(key->modifiers & modifiers) == key->modifiers) {
return true;
}
}
@ -98,42 +98,53 @@ static bool caps_word_is_caps_includelist(const struct behavior_caps_word_config
return false;
}
static bool caps_word_is_alpha(uint8_t usage_id) {
return (usage_id >= HID_USAGE_KEY_KEYBOARD_A && usage_id <= HID_USAGE_KEY_KEYBOARD_Z);
static bool caps_word_is_alpha(uint16_t usage_page, zmk_key_t usage_id) {
if (usage_page != HID_USAGE_KEY) {
return false;
}
return usage_id >= HID_USAGE_KEY_KEYBOARD_A && usage_id <= HID_USAGE_KEY_KEYBOARD_Z;
}
static bool caps_word_is_numeric(uint8_t usage_id) {
return (usage_id >= HID_USAGE_KEY_KEYBOARD_1_AND_EXCLAMATION &&
usage_id <= HID_USAGE_KEY_KEYBOARD_0_AND_RIGHT_PARENTHESIS);
}
static bool caps_word_is_numeric(uint16_t usage_page, zmk_key_t usage_id) {
if (usage_page != HID_USAGE_KEY) {
return false;
}
static bool caps_word_should_continue(const struct behavior_caps_word_config *config,
struct zmk_keycode_state_changed *ev) {
return caps_word_is_alpha(ev->keycode) || caps_word_is_numeric(ev->keycode) ||
is_mod(ev->usage_page, ev->keycode) ||
caps_word_is_caps_includelist(config, ev->usage_page, ev->keycode,
ev->implicit_modifiers);
return ((usage_id >= HID_USAGE_KEY_KEYBOARD_1_AND_EXCLAMATION &&
usage_id <= HID_USAGE_KEY_KEYBOARD_0_AND_RIGHT_PARENTHESIS) ||
(usage_id >= HID_USAGE_KEY_KEYPAD_1_AND_END &&
usage_id <= HID_USAGE_KEY_KEYPAD_0_AND_INSERT)) ||
usage_id == HID_USAGE_KEY_KEYPAD_00 || usage_id == HID_USAGE_KEY_KEYPAD_000;
}
static bool caps_word_should_enhance(const struct behavior_caps_word_config *config,
struct zmk_keycode_state_changed *ev) {
if (ev->usage_page != HID_USAGE_KEY) {
return false;
}
if (caps_word_is_alpha(ev->keycode)) {
// Unless no-default-keys is set, alpha keys are enhanced.
if (!config->no_default_keys && caps_word_is_alpha(ev->usage_page, ev->keycode)) {
return true;
}
return false;
zmk_mod_flags_t modifiers = ev->implicit_modifiers | zmk_hid_get_explicit_mods();
return key_list_contains(config->shift_keys, ev->usage_page, ev->keycode, modifiers);
}
static void caps_word_enhance_usage(const struct behavior_caps_word_config *config,
struct zmk_keycode_state_changed *ev) {
if (caps_word_should_enhance(config, ev)) {
LOG_DBG("Enhancing usage 0x%02X with modifiers: 0x%02X", ev->keycode, config->mods);
ev->implicit_modifiers |= config->mods;
static bool caps_word_should_continue(const struct behavior_caps_word_config *config,
struct zmk_keycode_state_changed *ev) {
// Modifiers do not break a word, nor does any key that is enhanced.
if (is_mod(ev->usage_page, ev->keycode) || caps_word_should_enhance(config, ev)) {
return true;
}
// Unless no-default-keys is set, number keys do not break a word.
if (!config->no_default_keys && caps_word_is_numeric(ev->usage_page, ev->keycode)) {
return true;
}
zmk_mod_flags_t modifiers = ev->implicit_modifiers | zmk_hid_get_explicit_mods();
return key_list_contains(config->continue_keys, ev->usage_page, ev->keycode, modifiers);
}
static int caps_word_keycode_state_changed_listener(const zmk_event_t *eh) {
@ -151,7 +162,10 @@ static int caps_word_keycode_state_changed_listener(const zmk_event_t *eh) {
const struct behavior_caps_word_config *config = dev->config;
caps_word_enhance_usage(config, ev);
if (caps_word_should_enhance(config, ev)) {
LOG_DBG("Enhancing usage 0x%02X with modifiers: 0x%02X", ev->keycode, config->mods);
ev->implicit_modifiers |= config->mods;
}
if (!caps_word_should_continue(config, ev)) {
LOG_DBG("Deactivating caps_word for 0x%02X - 0x%02X", ev->usage_page, ev->keycode);
@ -164,17 +178,26 @@ static int caps_word_keycode_state_changed_listener(const zmk_event_t *eh) {
static int behavior_caps_word_init(const struct device *dev) { return 0; }
#define CAPS_WORD_LABEL(i, _n) DT_INST_LABEL(i)
#define KEY_LIST_ITEM(i, n, prop) ZMK_KEY_PARAM_DECODE(DT_INST_PROP_BY_IDX(n, prop, i))
#define CONTINUATION_ITEM(i, n) ZMK_KEY_PARAM_DECODE(DT_INST_PROP_BY_IDX(n, continue_list, i))
#define PROP_KEY_LIST(n, prop) \
COND_CODE_1(DT_NODE_HAS_PROP(DT_DRV_INST(n), prop), \
({ \
.size = DT_INST_PROP_LEN(n, prop), \
.keys = {LISTIFY(DT_INST_PROP_LEN(n, prop), KEY_LIST_ITEM, (, ), n, prop)}, \
}), \
({.size = 0}))
#define KP_INST(n) \
static const struct key_list caps_word_continue_list_##n = PROP_KEY_LIST(n, continue_list); \
static const struct key_list caps_word_shift_list_##n = PROP_KEY_LIST(n, shift_list); \
\
static struct behavior_caps_word_data behavior_caps_word_data_##n = {.active = false}; \
static struct behavior_caps_word_config behavior_caps_word_config_##n = { \
.mods = DT_INST_PROP_OR(n, mods, MOD_LSFT), \
.continuations = {LISTIFY(DT_INST_PROP_LEN(n, continue_list), CONTINUATION_ITEM, (, ), \
n)}, \
.continuations_count = DT_INST_PROP_LEN(n, continue_list), \
.continue_keys = &caps_word_continue_list_##n, \
.shift_keys = &caps_word_shift_list_##n, \
.no_default_keys = DT_INST_PROP(n, no_default_keys), \
}; \
BEHAVIOR_DT_INST_DEFINE(n, behavior_caps_word_init, NULL, &behavior_caps_word_data_##n, \
&behavior_caps_word_config_##n, POST_KERNEL, \

View file

@ -1,4 +1,3 @@
s/.*hid_listener_keycode_//p
s/.*hid_implicit_modifiers_//p
s/.*caps_word_enhance_usage/enhance_usage/p
s/.*caps_word_is_caps_includelist/caps_includelist/p
s/.*caps_word_keycode_state_changed_listener/state_changed/p

View file

@ -1,19 +1,17 @@
enhance_usage: Enhancing usage 0x04 with modifiers: 0x02
state_changed: Enhancing usage 0x04 with modifiers: 0x02
pressed: usage_page 0x07 keycode 0x04 implicit_mods 0x02 explicit_mods 0x00
press: Modifiers set to 0x02
released: usage_page 0x07 keycode 0x04 implicit_mods 0x00 explicit_mods 0x00
release: Modifiers set to 0x00
pressed: usage_page 0x07 keycode 0xE1 implicit_mods 0x00 explicit_mods 0x00
press: Modifiers set to 0x02
caps_includelist: Comparing with 0x07 - 0x2D (with implicit mods: 0x02)
caps_includelist: Continuing capsword, found included usage: 0x07 - 0x2D
pressed: usage_page 0x07 keycode 0x2D implicit_mods 0x00 explicit_mods 0x00
press: Modifiers set to 0x02
released: usage_page 0x07 keycode 0x2D implicit_mods 0x00 explicit_mods 0x00
release: Modifiers set to 0x02
released: usage_page 0x07 keycode 0xE1 implicit_mods 0x00 explicit_mods 0x00
release: Modifiers set to 0x00
enhance_usage: Enhancing usage 0x04 with modifiers: 0x02
state_changed: Enhancing usage 0x04 with modifiers: 0x02
pressed: usage_page 0x07 keycode 0x04 implicit_mods 0x02 explicit_mods 0x00
press: Modifiers set to 0x02
released: usage_page 0x07 keycode 0x04 implicit_mods 0x00 explicit_mods 0x00

View file

@ -1,4 +1,3 @@
s/.*hid_listener_keycode_//p
s/.*hid_implicit_modifiers_//p
s/.*caps_word_enhance_usage/enhance_usage/p
s/.*caps_word_is_caps_includelist/caps_includelist/p
s/.*caps_word_keycode_state_changed_listener/state_changed/p

View file

@ -1,16 +1,13 @@
enhance_usage: Enhancing usage 0x04 with modifiers: 0x02
state_changed: Enhancing usage 0x04 with modifiers: 0x02
pressed: usage_page 0x07 keycode 0x04 implicit_mods 0x02 explicit_mods 0x00
press: Modifiers set to 0x02
released: usage_page 0x07 keycode 0x04 implicit_mods 0x00 explicit_mods 0x00
release: Modifiers set to 0x00
caps_includelist: Comparing with 0x07 - 0x2D (with implicit mods: 0x02)
caps_includelist: Comparing with 0x07 - 0x2D (with implicit mods: 0x00)
caps_includelist: Continuing capsword, found included usage: 0x07 - 0x2D
pressed: usage_page 0x07 keycode 0x2D implicit_mods 0x00 explicit_mods 0x00
press: Modifiers set to 0x00
released: usage_page 0x07 keycode 0x2D implicit_mods 0x00 explicit_mods 0x00
release: Modifiers set to 0x00
enhance_usage: Enhancing usage 0x04 with modifiers: 0x02
state_changed: Enhancing usage 0x04 with modifiers: 0x02
pressed: usage_page 0x07 keycode 0x04 implicit_mods 0x02 explicit_mods 0x00
press: Modifiers set to 0x02
released: usage_page 0x07 keycode 0x04 implicit_mods 0x00 explicit_mods 0x00

View file

@ -1,4 +1,3 @@
s/.*hid_listener_keycode_//p
s/.*hid_implicit_modifiers_//p
s/.*caps_word_enhance_usage/enhance_usage/p
s/.*caps_word_is_caps_includelist/caps_includelist/p
s/.*caps_word_keycode_state_changed_listener/state_changed/p

View file

@ -1,4 +1,4 @@
enhance_usage: Enhancing usage 0x04 with modifiers: 0x02
state_changed: Enhancing usage 0x04 with modifiers: 0x02
pressed: usage_page 0x07 keycode 0x04 implicit_mods 0x02 explicit_mods 0x00
press: Modifiers set to 0x02
released: usage_page 0x07 keycode 0x04 implicit_mods 0x00 explicit_mods 0x00
@ -7,7 +7,7 @@ pressed: usage_page 0x07 keycode 0x23 implicit_mods 0x00 explicit_mods 0x00
press: Modifiers set to 0x00
released: usage_page 0x07 keycode 0x23 implicit_mods 0x00 explicit_mods 0x00
release: Modifiers set to 0x00
enhance_usage: Enhancing usage 0x04 with modifiers: 0x02
state_changed: Enhancing usage 0x04 with modifiers: 0x02
pressed: usage_page 0x07 keycode 0x04 implicit_mods 0x02 explicit_mods 0x00
press: Modifiers set to 0x02
released: usage_page 0x07 keycode 0x04 implicit_mods 0x00 explicit_mods 0x00

View file

@ -0,0 +1,3 @@
s/.*hid_listener_keycode_//p
s/.*hid_implicit_modifiers_//p
s/.*caps_word_keycode_state_changed_listener/state_changed/p

View file

@ -0,0 +1,15 @@
state_changed: Enhancing usage 0x04 with modifiers: 0x02
pressed: usage_page 0x07 keycode 0x04 implicit_mods 0x02 explicit_mods 0x00
press: Modifiers set to 0x02
released: usage_page 0x07 keycode 0x04 implicit_mods 0x00 explicit_mods 0x00
release: Modifiers set to 0x00
state_changed: Enhancing usage 0x2D with modifiers: 0x02
pressed: usage_page 0x07 keycode 0x2D implicit_mods 0x02 explicit_mods 0x00
press: Modifiers set to 0x02
released: usage_page 0x07 keycode 0x2D implicit_mods 0x00 explicit_mods 0x00
release: Modifiers set to 0x00
state_changed: Enhancing usage 0x04 with modifiers: 0x02
pressed: usage_page 0x07 keycode 0x04 implicit_mods 0x02 explicit_mods 0x00
press: Modifiers set to 0x02
released: usage_page 0x07 keycode 0x04 implicit_mods 0x00 explicit_mods 0x00
release: Modifiers set to 0x00

View file

@ -0,0 +1,22 @@
#include <dt-bindings/zmk/keys.h>
#include <behaviors.dtsi>
#include <dt-bindings/zmk/kscan_mock.h>
#include "../behavior_keymap.dtsi"
&caps_word {
continue-list = <>;
shift-list = <MINUS>;
};
&kscan {
events = <
ZMK_MOCK_PRESS(0,0,10)
ZMK_MOCK_RELEASE(0,0,10)
ZMK_MOCK_PRESS(0,1,10)
ZMK_MOCK_RELEASE(0,1,10)
ZMK_MOCK_PRESS(1,1,10)
ZMK_MOCK_RELEASE(1,1,10)
ZMK_MOCK_PRESS(0,1,10)
ZMK_MOCK_RELEASE(0,1,10)
>;
};

View file

@ -0,0 +1,3 @@
s/.*hid_listener_keycode_//p
s/.*hid_implicit_modifiers_//p
s/.*caps_word_keycode_state_changed_listener/state_changed/p

View file

@ -0,0 +1,14 @@
state_changed: Enhancing usage 0x2D with modifiers: 0x02
pressed: usage_page 0x07 keycode 0x2D implicit_mods 0x02 explicit_mods 0x00
press: Modifiers set to 0x02
released: usage_page 0x07 keycode 0x2D implicit_mods 0x00 explicit_mods 0x00
release: Modifiers set to 0x00
state_changed: Deactivating caps_word for 0x07 - 0x04
pressed: usage_page 0x07 keycode 0x04 implicit_mods 0x00 explicit_mods 0x00
press: Modifiers set to 0x00
released: usage_page 0x07 keycode 0x04 implicit_mods 0x00 explicit_mods 0x00
release: Modifiers set to 0x00
pressed: usage_page 0x07 keycode 0x2D implicit_mods 0x00 explicit_mods 0x00
press: Modifiers set to 0x00
released: usage_page 0x07 keycode 0x2D implicit_mods 0x00 explicit_mods 0x00
release: Modifiers set to 0x00

View file

@ -0,0 +1,22 @@
#include <dt-bindings/zmk/keys.h>
#include <behaviors.dtsi>
#include <dt-bindings/zmk/kscan_mock.h>
#include "../behavior_keymap.dtsi"
&caps_word {
no-default-keys;
shift-list = <MINUS>;
};
&kscan {
events = <
ZMK_MOCK_PRESS(0,0,10)
ZMK_MOCK_RELEASE(0,0,10)
ZMK_MOCK_PRESS(1,1,10)
ZMK_MOCK_RELEASE(1,1,10)
ZMK_MOCK_PRESS(0,1,10)
ZMK_MOCK_RELEASE(0,1,10)
ZMK_MOCK_PRESS(1,1,10)
ZMK_MOCK_RELEASE(1,1,10)
>;
};

View file

@ -1,3 +1,3 @@
s/.*hid_listener_keycode_//p
s/.*hid_implicit_modifiers_//p
s/.*caps_word_enhance_usage/enhance_usage/p
s/.*caps_word_keycode_state_changed_listener/state_changed/p

View file

@ -1,8 +1,9 @@
enhance_usage: Enhancing usage 0x04 with modifiers: 0x02
state_changed: Enhancing usage 0x04 with modifiers: 0x02
pressed: usage_page 0x07 keycode 0x04 implicit_mods 0x02 explicit_mods 0x00
press: Modifiers set to 0x02
released: usage_page 0x07 keycode 0x04 implicit_mods 0x00 explicit_mods 0x00
release: Modifiers set to 0x00
state_changed: Deactivating caps_word for 0x07 - 0x2D
pressed: usage_page 0x07 keycode 0x2D implicit_mods 0x00 explicit_mods 0x00
press: Modifiers set to 0x00
released: usage_page 0x07 keycode 0x2D implicit_mods 0x00 explicit_mods 0x00

View file

@ -1,3 +1,3 @@
s/.*hid_listener_keycode_//p
s/.*hid_implicit_modifiers_//p
s/.*caps_word_enhance_usage/enhance_usage/p
s/.*caps_word_keycode_state_changed_listener/state_changed/p

View file

@ -1,4 +1,4 @@
enhance_usage: Enhancing usage 0x04 with modifiers: 0x02
state_changed: Enhancing usage 0x04 with modifiers: 0x02
pressed: usage_page 0x07 keycode 0x04 implicit_mods 0x02 explicit_mods 0x00
press: Modifiers set to 0x02
released: usage_page 0x07 keycode 0x04 implicit_mods 0x00 explicit_mods 0x00

View file

@ -7,7 +7,9 @@ sidebar_label: Caps Word
The caps word behavior behaves similar to a caps lock, but will automatically deactivate when any key not in a continue list is pressed, or if the caps word key is pressed again. For smaller keyboards using [mod-taps](/docs/behaviors/mod-tap), this can help avoid repeated alternating holds when typing words in all caps.
The modifiers are applied only to to the alphabetic (`A` to `Z`) keycodes, to avoid automatically applying them to numeric values, etc.
## Caps Word
Applies shift to capitalize alphabetic keys. Remains active but does not apply shift when numeric keys, underscore, backspace, or delete are pressed.
### Behavior Binding
@ -19,50 +21,103 @@ Example:
&caps_word
```
### Configuration
## Programmer Word
#### Continue List
This is identical to `&caps_word` except that shift is also applied to `MINUS`. This can be useful when programming to type certain symbols. For example, enabling `&prog_word` and typing `some-constant` results in `SOME_CONSTANT`.
By default, the caps word will remain active when any alphanumeric character or underscore (`UNDERSCORE`), backspace (`BACKSPACE`), or delete (`DELETE`) characters are pressed. Any other non-modifier keycode sent will turn off caps word. If you would like to override this, you can set a new array of keys in the `continue-list` property in your keymap:
### Behavior Binding
- Reference: `&prog_word`
Example:
```dts
&prog_word
```
## Configuration
### Shift List
Caps word will apply shift to the following:
- Alphabetic keys (`A` through `Z`).
- Keys in the `shift-list` property (defaults to empty for `&caps_word` and `MINUS` for `&prog_word`).
You can add more key codes to be shifted by overriding the `shift-list` property in your keymap:
```dts
&caps_word {
shift-list = <DOT>;
};
/ {
keymap {
...
};
};
```
### Continue List
Caps word will remain active when any of the following are pressed:
- Alphabetic keys and keys in `shift-list`.
- Numeric keys (`N0` through `N9` and `KP_N0` through `KP_N9`).
- Modifier keys.
- Keys which do not send a key code (such as layer keys).
- Keys in the `continue-list` property (defaults to `UNDERSCORE`, `BACKSPACE`, and `DELETE`).
Any other key code sent will turn off caps word.
You can add more key codes to continue caps word by setting a `continue-list` property in your keymap.
```dts
&caps_word {
continue-list = <UNDERSCORE MINUS>;
};
```
/ {
keymap {
...
};
### No Default Keys
By setting a `no-default-keys` property in your keymap, caps word will not automatically include alphabetic keys in `shift-list` or numeric keys in `continue-list`. This lets you explicitly control which keys are shifted and which continue a word, which may be useful in cases such as when your operating system is set to a non-US keyboard layout.
```dts
&caps_word {
no-default-keys;
shift-list = <A B C>;
continue-list = <D E F>;
};
```
#### Applied Modifier(s)
### Applied Modifier(s)
In addition, if you would like _multiple_ modifiers, instead of just `MOD_LSFT`, you can override the `mods` property:
If you would like different or multiple modifiers instead of just `MOD_LSFT`, you can override the `mods` property:
```dts
&caps_word {
mods = <(MOD_LSFT | MOD_LALT)>;
};
/ {
keymap {
...
};
};
```
### Multiple Caps Breaks
If you want to use multiple caps breaks with different codes to break the caps, you can add additional caps words instances to use in your keymap:
You can add multiple caps words instances with different sets of properties in your keymap:
```dts
/ {
prog_caps: prog_caps {
compatible = "zmk,behavior-caps-word";
#binding-cells = <0>;
continue-list = <UNDERSCORE>;
behaviors {
caps_sentence: caps_sentence {
compatible = "zmk,behavior-caps-word";
#binding-cells = <0>;
continue-list = <SPACE>;
};
ctrl_word: ctrl_word {
compatible = "zmk,behavior-caps-word";
#binding-cells = <0>;
mods = <MOD_LCTL>;
};
};
keymap {

View file

@ -29,21 +29,24 @@ Definition file: [zmk/app/dts/bindings/behaviors/zmk,behavior-caps-word.yaml](ht
Applies to: `compatible = "zmk,behavior-caps-word"`
| Property | Type | Description | Default |
| ---------------- | ----- | ------------------------------------------------------------------ | ------------------------------- |
| `#binding-cells` | int | Must be `<0>` | |
| `continue-list` | array | List of [key codes](/docs/codes) which do not deactivate caps lock | `<UNDERSCORE BACKSPACE DELETE>` |
| `mods` | int | A bit field of modifiers to apply | `<MOD_LSFT>` |
| Property | Type | Description | Default |
| ----------------- | ----- | -------------------------------------------------------------------- | ------------------------------- |
| `#binding-cells` | int | Must be `<0>` | |
| `continue-list` | array | List of [key codes](/docs/codes) which do not deactivate caps word | `<UNDERSCORE BACKSPACE DELETE>` |
| `mods` | int | A bit field of modifiers to apply | `<MOD_LSFT>` |
| `no-default-keys` | bool | Do not add any keys to `continue-list` or `shift-list` by default | false |
| `shift-list` | array | List of [key codes](/docs/codes) which should have modifiers applied | `<>` |
`continue-list` is treated as if it always includes alphanumeric characters (A-Z, 0-9).
By default, `shift-list` is treated as if it always includes alphabetic keys (A-Z) and `continue-list` as if it always includes numeric keys (0-9 and numpad digits). Setting `no-default-keys` disables this behavior.
See [dt-bindings/zmk/modifiers.h](https://github.com/zmkfirmware/zmk/blob/main/app/include/dt-bindings/zmk/modifiers.h) for a list of modifiers.
You can use the following nodes to tweak the default behaviors:
| Node | Behavior |
| ------------ | -------------------------------------- |
| `&caps_word` | [Caps Word](../behaviors/caps-word.md) |
| Node | Behavior |
| ------------ | ------------------------------------------------------------ |
| `&caps_word` | [Caps Word](../behaviors/caps-word.md#caps-word) |
| `&prog_word` | [Programmer Word](../behaviors/caps-word.md#programmer-word) |
## Hold-Tap