feat: Add the ability to keep/omit behaviors for a given build.

* Use defines to keep either all behaviors with omits, or selective behaviors with
  explicit kept behavior, before including `behavior.dtsi` in keymaps.
* Default ZMK_BEHAVIORS_KEEP_ALL when building with the studio RPC
  endpoint snippet.
This commit is contained in:
Peter Johanson
2024-08-05 16:50:35 -06:00
committed by Pete Johanson
parent d77e400eb9
commit fd28eab179
22 changed files with 129 additions and 21 deletions

View File

@@ -4,9 +4,14 @@
* SPDX-License-Identifier: MIT
*/
#include <dt-bindings/zmk/behaviors.h>
/ {
behaviors {
/omit-if-no-ref/ sk: sticky_key {
#if ZMK_BEHAVIOR_OMIT(SK)
/omit-if-no-ref/
#endif
sk: sticky_key {
compatible = "zmk,behavior-sticky-key";
#binding-cells = <1>;
release-after-ms = <1000>;
@@ -14,7 +19,10 @@
ignore-modifiers;
display-name = "Sticky Key";
};
/omit-if-no-ref/ sl: sticky_layer {
#if ZMK_BEHAVIOR_OMIT(STICKY_LAYER)
/omit-if-no-ref/
#endif
sl: sticky_layer {
compatible = "zmk,behavior-sticky-key";
#binding-cells = <1>;
release-after-ms = <1000>;