Skip to content

ZMK module to invoke behaviors on certain events.

License

Notifications You must be signed in to change notification settings

ssbb/zmk-listeners

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

ZMK module to invoke behaviors on certain events.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published