Skip to content

Latest commit

 

History

History
96 lines (72 loc) · 3.01 KB

README.md

File metadata and controls

96 lines (72 loc) · 3.01 KB

zmk-listeners

ZMK module to invoke behaviors on certain events.

Usage

Add the following entries to remotes and projects in config/west.yml.

manifest:
  remotes:
    - name: zmkfirmware
      url-base: https://github.com/zmkfirmware
    - name: ssbb
      url-base: https://github.com/ssbb
  projects:
    - name: zmk
      remote: zmkfirmware
      import: app/west.yml
    - name: zmk-listeners
      remote: ssbb
      revision: v1
  self:
    path: config

Layer Listeners

Layer listeners are specified like this:

/ {
    layer_listeners {
        compatible = "zmk,layer-listeners";

        // Call &haptic_feedback_in on layer enter, and &haptic_feedback_out on layer leave
        nav_num_feedback {
            layers = <NAV NUM>;
            bindings = <&haptic_feedback_in &haptic_feedback_out>;
        };

        // Call &reset_nav on NAV layer leave
        nav_reset {
            layers = <NAV>;
            bindings = <&none &reset_nav>;
        };
    };
}

Root properties

  • tap-ms: The time to wait (in milliseconds) between the press and release events of a triggered behavior. Defaults to 5 ms.
  • wait-ms: The time to wait (in milliseconds) before triggering the next listener. Defaults to 5 ms.

Listener Properties

Each listener is defined as a child node.

  • layers (required): A list of layers to which this listener should apply.
  • bindings (required): The first behavior is triggered on layer entry, and the second on layer exit. Use &none for the other if you need only one. Second binding (layer leave) can be omitted if not needed.

Keycode Listeners

/ {
    keycode_listeners {
        compatible = "zmk,keycode-listeners";

        // Call &haptic_feedback_key_press on key press, and &haptic_feedback_key_release on key release
        a_b_feedback {
            layers = <NAV NUM>;
            keycodes = <A B>;
            bindings = <&haptic_feedback_key_press &haptic_feedback_key_release>;
        };
    };
}

Root properties

  • tap-ms: The time to wait (in milliseconds) between the press and release events of a triggered behavior. Defaults to 5 ms.
  • wait-ms: The time to wait (in milliseconds) before triggering the next listener. Defaults to 5 ms.

Listener Properties

Each listener is defined as a child node.

  • keycodes (required): A list of keycodes to which this listener should apply. Implicit modifiers (eg LG(C)) are supported.
  • layers (optional): A list of layers to which this listener should apply.
  • bindings (required): The first behavior is triggered on key press, and the second on key release. Use &none for the other if you need only one. Second binding (key release) can be omitted if not needed.

References