zmk/docs/docs/keymaps/input-processors/index.md

4.6 KiB

title sidebar_label
Input Processor Overview Overview

Input Processors Overview

"Input processors" are small pieces of functionality that process and optionally modify events generated from emulated and physical pointing devices. Processors can do things like scaling movement values to make them larger or smaller for detailed work, swapping the event types to turn movements into scroll events, or temporarily enabling an extra layer while the pointer is in use.

Usage

For information on using input processors with a given pointing device, see input processor usage.

Available Processors

Below is a summary of pre-defined input processors and user-definable input processors available in ZMK, with references to documentation pages describing them.

Pre-Defined Processors

A set of predefined input processors is available by adding the following at the top of your keymap/overlay file:

#include <input/processors.dtsi>

Once included, you can use the following:

Binding Processor Description
&zip_xy_scaler XY Scaler Scale the X/Y input events using a multiplier and divisor
&zip_x_scaler X Scaler Scale the X input events using a multiplier and divisor
&zip_y_scaler Y Scaler Scale the Y input events using a multiplier and divisor
&zip_scroll_scaler Scroll Scaler Scale wheel/horizontal wheel input events using a multiplier and divisor
&zip_xy_transform XY Transform Transform X/Y values, e.g. inverting or swapping
&zip_scroll_transform Scroll Transform Transform wheel/horizontal wheel values, e.g. inverting or swapping
&zip_xy_to_scroll_mapper XY To Scroll Mapper Map X/Y values to scroll wheel/horizontal wheel events
&zip_xy_swap_mapper XY Swap Mapper Swap X/Y values
&zip_temp_layer Temporary Layer Temporarily enable a layer during pointer use
&zip_button_behaviors Mouse Button Behaviors Trigger behaviors when certain mouse buttons are pressed

User-Defined Processors

Several of the input processors that have predefined instances, e.g. &zip_xy_scaler or &zip_xy_to_scroll_mapper can also have new instances created with custom properties around which input codes to scale, or which codes to map, etc.

Compatible Processor Description
zmk,input-processor-scaler Scaler Scale value of input events
zmk,input-processor-transform Transform Perform various transforms like inverting values
zmk,input-processor-code-mapper Code Mapper Map one event code to another type
zmk,input-processor-behaviors Behaviors Trigger behaviors for certain matching input events
zmk,input-processor-temp-layer Temporary layer Temporarily enable a layer when input events are received

External Processors

Much like behaviors, custom input processors can also be added to external modules to allow complete control of the processing operation. See input_processor.h for the definition of the driver API.