Advertisement
Guest User

Untitled

a guest
Aug 20th, 2023
246
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 17.87 KB | None | 0 0
  1. /*
  2.  * Copyright (c) 2020 The ZMK Contributors
  3.  *
  4.  * SPDX-License-Identifier: MIT
  5.  */
  6.  
  7. #include <behaviors.dtsi>
  8. #include <dt-bindings/zmk/keys.h>
  9. #include <dt-bindings/zmk/bt.h>
  10. #include <dt-bindings/zmk/backlight.h>
  11.  
  12.  
  13. #define MACOS     0
  14. #define FKEYS     1
  15. #define NUMBERS   2
  16. #define WINDOWS   3
  17. #define W_FKEYS   4
  18. #define W_NUMBERS 5
  19. #define KB_CONFIG 6
  20.  
  21.  
  22. / {
  23.  
  24.     conditional_layers {
  25.         compatible = "zmk,conditional-layers";
  26.         win_fkeys {
  27.             if-layers = <WINDOWS FKEYS>;
  28.             then-layer = <W_FKEYS>;
  29.         };
  30.         win_numbers {
  31.             if-layers = <WINDOWS NUMBERS>;
  32.             then-layer = <W_NUMBERS>;
  33.         };
  34.     };
  35.  
  36.  
  37.     behaviors {
  38.         // Toggle F-Keys Layer
  39.         td0: tap_dance_0 {
  40.             compatible = "zmk,behavior-tap-dance";
  41.             label = "TAP_DANCE_0";
  42.             #binding-cells = <0>;
  43.             tapping-term-ms = <300>;
  44.             bindings = <&mo FKEYS>, <&tog FKEYS>, <&tog KB_CONFIG>;
  45.         };
  46.         // Toggle Numbers layer
  47.         td1: tap_dance_1 {
  48.             compatible = "zmk,behavior-tap-dance";
  49.             label = "TAP_DANCE_1";
  50.             #binding-cells = <0>;
  51.             tapping-term-ms = <200>;
  52.             bindings = <&mo NUMBERS>, <&tog NUMBERS>;
  53.         };
  54.         // Toggle capsword left
  55.         td2: tap_dance_2 {
  56.             compatible = "zmk,behavior-tap-dance";
  57.             label = "TAP_DANCE_2";
  58.             #binding-cells = <0>;
  59.             tapping-term-ms = <350>;
  60.             bindings = <&kp LSHFT>, <&caps_word>, <&kp CAPS>;
  61.         };
  62.         // Toggle capsword right
  63.         td3: tap_dance_3 {
  64.             compatible = "zmk,behavior-tap-dance";
  65.             label = "TAP_DANCE_3";
  66.             #binding-cells = <0>;
  67.             tapping-term-ms = <350>;
  68.             bindings = <&kp RSHFT>, <&caps_word>, <&kp CAPS>;
  69.         };
  70.         // Toggle Windows layer
  71.         td4: tap_dance_4 {
  72.             compatible = "zmk,behavior-tap-dance";
  73.             label = "TAP_DANCE_4";
  74.             #binding-cells = <0>;
  75.             tapping-term-ms = <200>;
  76.             bindings = <&kp LGUI>, <&tog WINDOWS>;
  77.         };
  78.         // Toggle Windows layer
  79.         td5: tap_dance_5 {
  80.             compatible = "zmk,behavior-tap-dance";
  81.             label = "TAP_DANCE_5";
  82.             #binding-cells = <0>;
  83.             tapping-term-ms = <200>;
  84.             bindings = <&kp RGUI>, <&tog WINDOWS>;
  85.         };
  86.     };
  87.  
  88.  
  89.     macros {
  90.         lstart: lstart {
  91.             label = "Line_Start";
  92.             compatible = "zmk,behavior-macro";
  93.             #binding-cells = <0>;
  94.             bindings
  95.                 = <&macro_press &kp LGUI>
  96.                 , <&macro_tap &kp LEFT>
  97.                 , <&macro_release &kp LGUI>
  98.                 ;
  99.         };
  100.         lend: lend {
  101.             label = "Line_End";
  102.             compatible = "zmk,behavior-macro";
  103.             #binding-cells = <0>;
  104.             bindings
  105.                 = <&macro_press &kp LGUI>
  106.                 , <&macro_tap &kp RIGHT>
  107.                 , <&macro_release &kp LGUI>
  108.                 ;
  109.         };
  110.         scrsh: scrsh {
  111.             label = "Screenshot";
  112.             compatible = "zmk,behavior-macro";
  113.             #binding-cells = <0>;
  114.             bindings
  115.                 = <&macro_press &kp LGUI>
  116.                 , <&macro_press &kp LSHIFT>
  117.                 , <&macro_tap &kp N3>
  118.                 , <&macro_release &kp LSHFT>
  119.                 , <&macro_release &kp LGUI>
  120.                 ;
  121.         };
  122.         scrcr: scrcr {
  123.             label = "Screen_Crop";
  124.             compatible = "zmk,behavior-macro";
  125.             #binding-cells = <0>;
  126.             bindings
  127.                 = <&macro_press &kp LGUI>
  128.                 , <&macro_press &kp LSHIFT>
  129.                 , <&macro_tap &kp N4>
  130.                 , <&macro_release &kp LSHFT>
  131.                 , <&macro_release &kp LGUI>
  132.                 ;
  133.         };
  134.         wscrcr: wscrcr {
  135.             label = "Windows_Screen_Crop";
  136.             compatible = "zmk,behavior-macro";
  137.             #binding-cells = <0>;
  138.             bindings
  139.                 = <&macro_press &kp LGUI>
  140.                 , <&macro_press &kp LSHIFT>
  141.                 , <&macro_tap &kp S>
  142.                 , <&macro_release &kp LSHFT>
  143.                 , <&macro_release &kp LGUI>
  144.                 ;
  145.         };
  146.         pal: pal {
  147.             label = "Pallette";
  148.             compatible = "zmk,behavior-macro";
  149.             #binding-cells = <0>;
  150.             bindings
  151.                 = <&macro_press &kp LGUI>
  152.                 , <&macro_press &kp LCTRL>
  153.                 , <&macro_tap &kp SPACE>
  154.                 , <&macro_release &kp LCTRL>
  155.                 , <&macro_release &kp LGUI>
  156.                 ;
  157.         };
  158.         wpal: wpal {
  159.             label = "W_Pallette";
  160.             compatible = "zmk,behavior-macro";
  161.             #binding-cells = <0>;
  162.             bindings
  163.                 = <&macro_press &kp LGUI>
  164.                 , <&macro_tap &kp DOT>
  165.                 , <&macro_release &kp LGUI>
  166.                 ;
  167.         };
  168.     };
  169.  
  170.  
  171.     keymap {
  172.         compatible = "zmk,keymap";
  173.  
  174.         default_layer {
  175.             label = "Mac OS";
  176.             sensor-bindings = <&inc_dec_kp UP DOWN &inc_dec_kp RIGHT LEFT>;
  177.             bindings = <
  178. //---------------------------------------------------------------+                            +---------------------------------------------------------------//
  179. //          |         |          |           |          |        |                            |       |       |           |         |          |           //
  180.   &kp GRAVE   &kp Q     &kp W      &kp E        &kp R     &kp T                                 &kp Y   &kp U     &kp I      &kp O     &kp P     &kp BSPC
  181. //          |         |          |           |          |        |                            |       |       |           |         |          |           //
  182.   &kp TAB     &kp A     &kp S      &kp D        &kp F     &kp G                                 &kp H   &kp J     &kp K      &kp L    &kp SEMI    &kp SQT
  183. //          |         |          |           |          |        +-----------+    +-----------|       |       |           |         |          |           //
  184.     &td2      &kp Z     &kp X      &kp C        &kp V     &kp B     &kp F15          &kp F14    &kp N   &kp M   &kp COMMA   &kp DOT    &kp FSLH     &td3
  185. //--------------------|          |           |          |        |           |    |           |       |       |           |--------------------------------//  
  186.                         &kp LALT   &kp LCTRL     &td4     &td0     &kp ENTER        &kp SPACE   &td1    &td5    &kp RCTRL   &kp DEL
  187. //                    +----------|-----------|----------|--------------------+    +-----------|-------|--------|-----------|---------+                      //
  188.             >;
  189.         };
  190.  
  191.         f_keys_layer {
  192.             label = "F Keys";
  193.             sensor-bindings = <&inc_dec_kp C_VOL_UP C_VOL_DN &inc_dec_kp PLUS MINUS>;
  194.             bindings = <
  195. //-------------------------------------------------------------------------------+                           +-------------------------------------------------------------------//
  196. //          |            |            |              |            |              |                           |          |          |           |         |           |           //
  197.   &kp ESCAPE    &kp F1      &kp F2       &kp F3          &kp F4        &kp F5                                   &kp F6    &kp F7      &kp F8     &kp F9    &kp F10     &kp F11
  198. //          |            |            |              |            |              |                           |          |          |           |         |           |           //
  199.     &trans    &bt BT_PRV   &bt BT_NXT   &kp C_PREV     &kp C_PP     &kp C_NEXT                                 &lstart     &kp UP     &lend      &scrsh    &kp PG_UP   &kp F12
  200. //          |            |            |              |            |              +-------------+    +--------+          |          |           |         |           |           //
  201.     &trans    &bl BL_TOG  &bl BL_SET 2  &kp C_VOL_DN   &kp C_MUTE   &kp C_VOL_UP    &kp C_MUTE       &kp F16   &kp LEFT   &kp DOWN   &kp RIGHT   &scrcr    &kp PG_DN   &kp F13
  202. //-----------------------|            |              |            |              |             |    |        |          |          |           |         |-----------------------//  
  203.                             &trans         &trans       &trans        &trans        &trans            &trans    &trans    &trans      &trans     &trans
  204. //                       +------------|--------------|------------|--------------|-------------+    +--------|----------|----------|-----------|---------+                       //
  205.             >;
  206.  
  207.         };
  208.  
  209.         numbers_layer {
  210.             label = "Numbers";
  211.             sensor-bindings = <&inc_dec_kp UP DOWN &inc_dec_kp RIGHT LEFT>;
  212.             bindings = <
  213. //-------------------------------------------------------------------------------+                      +----------------------------------------------------------------------------//
  214. //          |          |                |                 |          |           |                      |           |               |          |          |               |          //
  215.   &kp UNDER    &kp N1        &kp N2           &kp N3         &kp N4     &kp N5                             &kp N6        &kp N7        &kp N8     &kp N9       &kp N0       &kp DEL
  216. //          |          |                |                 |          |           |                      |           |               |          |          |               |          //
  217.     &trans    &kp EXCL       &kp AT          &kp HASH       &kp DLLR   &kp PRCNT                          &kp CARET   &kp AMPERSAND   &kp STAR   &kp LPAR     &kp RPAR      &kp FSLH
  218. //          |          |                |                 |          |           +--------+     +-------|           |               |                     |               |          //
  219.    &trans       &pal     &kp LEFT_BRACE   &kp RIGHT_BRACE   &kp PIPE   &kp EQUAL   &trans        &trans   &kp MINUS     &kp PLUS      &kp LBKT   &kp RBKT   &kp BACKSLASH   &kp DOT
  220. //---------------------|                |                 |          |           |        |    |                    |               |          |          |--------------------------//
  221.                             &trans            &trans         &trans     &trans     &trans        &trans    &trans       &trans         &trans     &trans
  222. //                     +----------------|-----------------|----------|-----------|--------+    +--------|----------|----------------|----------|----------+                          //
  223.             >;
  224.         };
  225.  
  226.         windows_default_layer {
  227.             label = "Windows";
  228.             sensor-bindings = <&inc_dec_kp UP DOWN &inc_dec_kp RIGHT LEFT>;
  229.             bindings = <
  230. //-----------------------------------------------------------------+                        +------------------------------------------------------------------//
  231. //          |          |          |          |          |          |                        |          |          |          |          |          |           //
  232.     &trans     &trans     &trans     &trans     &trans     &trans                              &trans     &trans     &trans     &trans     &trans     &trans
  233. //          |          |          |          |          |          |                        |          |          |          |          |          |           //
  234.     &trans     &trans     &trans     &trans     &trans     &trans                              &trans     &trans     &trans     &trans     &trans     &trans
  235. //          |          |          |          |          |          +--------+     +---------|          |          |          |          |          |           //
  236.     &trans     &trans     &trans     &trans     &trans     &trans    &trans         &trans     &trans     &trans     &trans     &trans     &trans     &trans
  237. //---------------------|          |          |          |          |        |     |         |          |          |          |          |----------------------//
  238.                           &trans     &trans     &trans     &trans    &trans         &trans     &trans     &trans     &trans     &trans
  239. //                     +----------|----------|----------|----------|--------+     +----------|---------|----------|----------|----------+                      //
  240.             >;
  241.         };
  242.  
  243.         windows_fkeys_layer {
  244.             label = "F Keys";
  245.             sensor-bindings = <&inc_dec_kp C_VOL_UP C_VOL_DN &inc_dec_kp PLUS MINUS>;
  246.             bindings = <
  247. //-----------------------------------------------------------------+                        +------------------------------------------------------------------//
  248. //          |          |          |          |          |          |                        |          |          |          |          |          |           //
  249.     &trans     &trans     &trans     &trans     &trans     &trans                              &trans     &trans     &trans     &trans     &trans     &trans
  250. //          |          |          |          |          |          |                        |          |          |          |          |          |           //
  251.     &trans     &trans     &trans     &trans     &trans     &trans                             &kp HOME    &trans     &kp END  &kp PSCRN    &trans     &trans
  252. //          |          |          |          |          |          +--------+     +---------|          |          |          |          |          |           //
  253.     &trans     &trans     &trans     &trans     &trans     &trans    &trans         &trans     &trans     &trans     &trans     &wscrcr    &trans     &trans
  254. //---------------------|          |          |          |          |        |     |         |          |          |          |          |----------------------//
  255.                           &trans     &trans     &trans     &trans    &trans         &trans     &trans     &trans     &trans     &trans
  256. //                     +----------|----------|----------|----------|--------+     +----------|---------|----------|----------|----------+                      //
  257.             >;
  258.         };
  259.  
  260.         windows_numbers_layer {
  261.             label = "Numbers";
  262.             sensor-bindings = <&inc_dec_kp UP DOWN &inc_dec_kp RIGHT LEFT>;
  263.             bindings = <
  264. //-----------------------------------------------------------------+                        +------------------------------------------------------------------//
  265. //          |          |          |          |          |          |                        |          |          |          |          |          |           //
  266.     &trans     &trans     &trans     &trans     &trans     &trans                              &trans     &trans     &trans     &trans     &trans     &trans
  267. //          |          |          |          |          |          |                        |          |          |          |          |          |           //
  268.     &trans     &trans     &trans     &trans     &trans     &trans                              &trans     &trans     &trans     &trans     &trans     &trans
  269. //          |          |          |          |          |          +--------+     +---------|          |          |          |          |          |           //
  270.     &trans     &wpal      &trans     &trans     &trans     &trans    &trans         &trans     &trans     &trans     &trans     &trans     &trans     &trans
  271. //---------------------|          |          |          |          |        |     |         |          |          |          |          |----------------------//
  272.                           &trans     &trans     &trans     &trans    &trans         &trans     &trans     &trans     &trans     &trans
  273. //                     +----------|----------|----------|----------|--------+     +----------|---------|----------|----------|----------+                      //
  274.             >;
  275.         };
  276.  
  277.         settings_layer {
  278.             label = "Settings";
  279.             sensor-bindings = <&inc_dec_kp UP DOWN &inc_dec_kp RIGHT LEFT>;
  280.             bindings = <
  281. //---------------------------------------------------------------------------------------+                        +------------------------------------------------------------------//
  282. //          |              |              |              |              |                |                        |          |          |          |          |          |           //
  283.     &trans    &bt BT_SEL 0   &bt BT_SEL 1   &bt BT_SEL 2   &bt BT_SEL 3    &bt BT_SEL 4                              &trans     &trans     &trans     &trans     &trans     &trans
  284. //          |              |              |              |              |                |                        |          |          |          |          |          |           //
  285.     &trans     &bt BT_PRV     &bt BT_NXT       &trans         &trans         &trans                                  &trans     &trans     &trans     &trans     &trans     &trans
  286. //          |              |              |              |              |                +--------+     +---------|          |          |          |          |          |           //
  287.     &trans       &trans       &bt BT_CLR     &bl BL_DEC    &bl BL_TOG      &bl BL_INC      &trans         &trans     &trans     &trans     &trans     &trans     &trans     &trans
  288. //-------------------------|              |              |              |                |        |     |         |          |          |          |          |----------------------//
  289.                                &trans          &trans         &trans      &tog KB_CONFIG   &trans         &trans     &trans     &trans     &trans     &trans
  290. //                         +--------------|--------------|--------------|----------------|--------+     +----------|---------|----------|----------|----------+                      //
  291.             >;
  292.         };
  293.  
  294.     };
  295. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement