feat(behaviors): add &out OUT_NONE (#3235)

Allow manually setting the preferred transport to `ZMK_TRANSPORT_NONE` with the `&out` behavior to prevent the keyboard from sending any output.
This commit is contained in:
snoyer
2026-03-31 08:52:27 +04:00
committed by GitHub
parent 3538843a09
commit 8a44ef109a
3 changed files with 15 additions and 6 deletions

View File

@@ -6,4 +6,5 @@
#define OUT_TOG 0
#define OUT_USB 1
#define OUT_BLE 2
#define OUT_BLE 2
#define OUT_NONE 3

View File

@@ -42,6 +42,11 @@ static const struct behavior_parameter_value_metadata std_values[] = {
.type = BEHAVIOR_PARAMETER_VALUE_TYPE_VALUE,
},
#endif // IS_ENABLED(CONFIG_ZMK_BLE)
{
.value = OUT_NONE,
.display_name = "No Output",
.type = BEHAVIOR_PARAMETER_VALUE_TYPE_VALUE,
},
};
static const struct behavior_parameter_metadata_set std_set = {
@@ -65,6 +70,8 @@ static int on_keymap_binding_pressed(struct zmk_behavior_binding *binding,
return zmk_endpoint_set_preferred_transport(ZMK_TRANSPORT_USB);
case OUT_BLE:
return zmk_endpoint_set_preferred_transport(ZMK_TRANSPORT_BLE);
case OUT_NONE:
return zmk_endpoint_set_preferred_transport(ZMK_TRANSPORT_NONE);
default:
LOG_ERR("Unknown output command: %d", binding->param1);
}

View File

@@ -29,11 +29,12 @@ header, which is added at the top of the keymap file:
This allows you to reference the actions defined in this header:
| Define | Action |
| --------- | ----------------------------------------------- |
| `OUT_USB` | Prefer sending to USB |
| `OUT_BLE` | Prefer sending to the current bluetooth profile |
| `OUT_TOG` | Toggle between USB and BLE |
| Define | Action |
| ---------- | ----------------------------------------------- |
| `OUT_USB` | Prefer sending to USB |
| `OUT_BLE` | Prefer sending to the current bluetooth profile |
| `OUT_TOG` | Toggle between USB and BLE |
| `OUT_NONE` | Prevent from sending any output |
## Output Selection Behavior