mirror of
https://github.com/averymd/sofle-v2-oled-zmk.git
synced 2026-01-07 23:32:00 +00:00
195 lines
23 KiB
Plaintext
195 lines
23 KiB
Plaintext
/*
|
|
* Copyright (c) 2020 The ZMK Contributors
|
|
*
|
|
* SPDX-License-Identifier: MIT
|
|
*/
|
|
|
|
#include <behaviors.dtsi>
|
|
#include <dt-bindings/zmk/bt.h>
|
|
#include <dt-bindings/zmk/ext_power.h>
|
|
#include <dt-bindings/zmk/keys.h>
|
|
#include <dt-bindings/zmk/rgb.h>
|
|
#include <zmk-helpers/helper.h>
|
|
#include <zmk-helpers/key-labels/sofle.h>
|
|
|
|
#define BASE 0
|
|
#define LOWER 1
|
|
#define RAISE 2
|
|
#define ADJUST 3
|
|
#define EXTEND 4
|
|
|
|
#define AS(keycode) &as LS(keycode) keycode // Autoshift Macro
|
|
|
|
#define KEYS_L LN0 LN1 LN2 LN3 LN4 LN5 LT0 LT1 LT2 LT3 LT4 LT5 LM0 LM1 LM2 LM3 LM4 LM5 LB0 LB1 LB2 LB3 LB4 LB5 // Left-hand keys.
|
|
#define KEYS_R RN0 RN1 RN2 RN3 RN4 RN5 RT0 RT1 RT2 RT3 RT4 RT5 RM0 RM1 RM2 RM3 RM4 RM5 RB0 RB1 RB2 RB3 RB4 RB5 // Right-hand keys.
|
|
#define THUMBS LH4 LH3 LH2 LH1 LH0 RH0 RH1 RH2 RH3 RH4 // Thumb keys.
|
|
|
|
/ {
|
|
// Activate ADJUST layer by pressing raise and lower
|
|
|
|
conditional_layers {
|
|
compatible = "zmk,conditional-layers";
|
|
|
|
adjust_layer {
|
|
if-layers = <LOWER RAISE>;
|
|
then-layer = <ADJUST>;
|
|
};
|
|
};
|
|
|
|
behaviors {
|
|
mt: mod_tap {
|
|
compatible = "zmk,behavior-hold-tap";
|
|
#binding-cells = <2>;
|
|
flavor = "tap-preferred";
|
|
tapping-term-ms = <300>;
|
|
bindings = <&kp>, <&kp>;
|
|
display-name = "Mod-Tap";
|
|
retro-tap;
|
|
};
|
|
hml: home_row_mod_left {
|
|
compatible = "zmk,behavior-hold-tap";
|
|
#binding-cells = <2>;
|
|
flavor = "balanced";
|
|
require-prior-idle-ms = <125>;
|
|
tapping-term-ms = <240>;
|
|
quick-tap-ms = <175>;
|
|
bindings = <&kp>, <&kp>;
|
|
hold-trigger-key-positions = <KEYS_R THUMBS>; // List of keys on the right side of the keyboard
|
|
hold-trigger-on-release;
|
|
};
|
|
hmr: home_row_mod_right {
|
|
compatible = "zmk,behavior-hold-tap";
|
|
#binding-cells = <2>;
|
|
flavor = "balanced";
|
|
require-prior-idle-ms = <125>;
|
|
tapping-term-ms = <240>;
|
|
quick-tap-ms = <175>;
|
|
bindings = <&kp>, <&kp>;
|
|
hold-trigger-key-positions = <KEYS_L THUMBS>; // List of keys on the left side of the keyboard
|
|
hold-trigger-on-release;
|
|
};
|
|
as: auto_shift {
|
|
compatible = "zmk,behavior-hold-tap";
|
|
#binding-cells = <2>;
|
|
tapping_term_ms = <200>;
|
|
quick_tap_ms = <0>;
|
|
flavor = "tap-preferred";
|
|
bindings = <&kp>, <&kp>;
|
|
};
|
|
};
|
|
|
|
keymap {
|
|
compatible = "zmk,keymap";
|
|
|
|
default_layer {
|
|
label = "default";
|
|
|
|
bindings = <
|
|
//╭─────────────┬─────────────┬─────────────┬─────────────┬─────────────┬─────────────┬─────────────╮ ╭─────────────┬─────────────┬─────────────┬─────────────┬─────────────┬─────────────┬─────────────╮
|
|
AS(GRAVE) AS(N1) AS(N2) AS(N3) AS(N4) AS(N5) AS(N6) AS(N7) AS(N8) AS(N9) AS(N0) AS(MINUS)
|
|
//├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤
|
|
AS(EQUAL) AS(Q) AS(W) AS(E) AS(R) AS(T) AS(Y) AS(U) AS(I) AS(O) AS(P) AS(BSLH)
|
|
//├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤
|
|
&kp BSPC AS(A) AS(S) AS(D) AS(F) AS(G) AS(H) AS(J) AS(K) AS(L) AS(SEMI) AS(SQT)
|
|
//├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤
|
|
&mo LOWER AS(Z) AS(X) AS(C) AS(V) AS(B) &kp LGUI &kp LG(LS(S)) AS(N) AS(M) AS(COMMA) AS(DOT) AS(FSLH) &kp RBRC
|
|
//├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤
|
|
AS(LBKT) &kp LC(F12) AS(RBKT) &mo EXTEND &kp SPACE &kp RET &mo RAISE AS(TAB) &kp DEL &kp ESC
|
|
// ╰─────────────┴─────────────┴─────────────┴─────────────┴─────────────╯ ╰─────────────┴─────────────┴─────────────┴─────────────┴─────────────╯
|
|
>;
|
|
|
|
sensor-bindings =
|
|
<&inc_dec_kp LEFT RIGHT>,
|
|
<&inc_dec_kp DOWN UP>;
|
|
};
|
|
|
|
lower_layer {
|
|
label = "lower";
|
|
|
|
bindings = <
|
|
//╭─────────────┬─────────────┬─────────────┬─────────────┬─────────────┬─────────────┬─────────────╮ ╭─────────────┬─────────────┬─────────────┬─────────────┬─────────────┬─────────────┬─────────────╮
|
|
&trans &kp F1 &kp F2 &kp F3 &kp F4 &kp F5 &kp F6 &kp F7 &kp F8 &kp F9 &kp F10 &kp F11
|
|
//├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤
|
|
&trans &kp N1 &kp N2 &kp N3 &kp N4 &kp N5 &kp N6 &kp N7 &kp N8 &kp N9 &kp N0 &kp F12
|
|
//├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤
|
|
&trans &kp EXCL &kp AT &kp HASH &kp DLLR &kp PRCNT &kp CARET &kp AMPS &kp KP_MULTIPLY &kp LPAR &kp RPAR &kp PIPE
|
|
//├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤
|
|
&trans &kp EQUAL &kp MINUS &kp KP_PLUS &kp LBRC &kp RBRC &trans &trans &kp LBKT &kp RBKT &kp SEMI &kp COLON &kp BSLH &trans
|
|
//├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤
|
|
&trans &trans &trans &trans &trans &trans &trans &trans &trans &trans
|
|
// ╰─────────────┴─────────────┴─────────────┴─────────────┴─────────────╯ ╰─────────────┴─────────────┴─────────────┴─────────────┴─────────────╯
|
|
>;
|
|
|
|
// TODO: Some binds are waiting for shifted keycode support.
|
|
|
|
sensor-bindings =
|
|
<&inc_dec_kp LEFT RIGHT>,
|
|
<&inc_dec_kp DOWN UP>;
|
|
};
|
|
|
|
raise_layer {
|
|
label = "raise";
|
|
|
|
bindings = <
|
|
//╭─────────────┬─────────────┬─────────────┬─────────────┬─────────────┬─────────────┬─────────────╮ ╭─────────────┬─────────────┬─────────────┬─────────────┬─────────────┬─────────────┬─────────────╮
|
|
&bt BT_CLR &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
|
|
//├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤
|
|
&trans &kp INS &kp PSCRN &kp K_CMENU &trans &trans &kp PG_UP &trans &kp UP &trans &kp N0 &trans
|
|
//├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤
|
|
&trans &kp LALT &kp LCTRL &kp LSHFT &trans &kp CLCK &kp PG_DN &kp LEFT &kp DOWN &kp RIGHT &kp DEL &kp BSPC
|
|
//├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤
|
|
&trans &kp K_UNDO &kp K_CUT &kp K_COPY &kp K_PASTE &trans &trans &trans &trans &trans &trans &trans &trans &trans
|
|
//├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤
|
|
&trans &trans &trans &trans &trans &trans &trans &trans &trans &trans
|
|
// ╰─────────────┴─────────────┴─────────────┴─────────────┴─────────────╯ ╰─────────────┴─────────────┴─────────────┴─────────────┴─────────────╯
|
|
>;
|
|
|
|
|
|
sensor-bindings =
|
|
<&inc_dec_kp LEFT RIGHT>,
|
|
<&inc_dec_kp DOWN UP>;
|
|
};
|
|
|
|
adjust_layer {
|
|
// ----------------------------------------------------------------------------------------------------------------------------
|
|
// | BTCLR | BT1 | BT2 | BT3 | BT4 | BT5 | | | | | | | |
|
|
// | EXTPWR | RGB_HUD | RGB_HUI | RGB_SAD | RGB_SAI | RGB_EFF | | | | | | | |
|
|
// | | RGB_BRD | RGB_BRI | | | | | | | | | | |
|
|
// | | | | | | | RGB_TOG | | | | | | | | |
|
|
// | | | | | | | | | | | |
|
|
|
|
label = "adjust";
|
|
bindings = <
|
|
&bt BT_CLR &bt BT_SEL 0 &bt BT_SEL 1 &bt BT_SEL 2 &bt BT_SEL 3 &bt BT_SEL 4 &none &none &none &none &none &none
|
|
&ext_power EP_TOG &rgb_ug RGB_HUD &rgb_ug RGB_HUI &rgb_ug RGB_SAD &rgb_ug RGB_SAI &rgb_ug RGB_EFF &none &none &none &none &none &none
|
|
&none &rgb_ug RGB_BRD &rgb_ug RGB_BRI &none &none &none &none &none &none &none &none &none
|
|
&none &none &none &none &none &none &rgb_ug RGB_TOG &none &none &none &none &none &none &none
|
|
&none &none &none &none &none &none &none &none &none &none
|
|
>;
|
|
};
|
|
|
|
extend_layer {
|
|
label = "extend";
|
|
|
|
bindings = <
|
|
//╭─────────────┬─────────────┬─────────────┬─────────────┬─────────────┬─────────────┬─────────────╮ ╭─────────────┬─────────────┬─────────────┬─────────────┬─────────────┬─────────────┬─────────────╮
|
|
&trans &kp F1 &kp F2 &kp F3 &kp F4 &kp F5 &kp F6 &kp F7 &kp F8 &kp F9 &kp F10 &kp F11
|
|
//├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤
|
|
&trans &kp INS &kp PSCRN &kp K_CMENU &kp LC(F) AS(TAB) &kp PG_UP &kp HOME &kp UP &kp END &kp N0 &kp F12
|
|
//├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤
|
|
&trans &sk LGUI &sk LALT &sk LSHFT &sk LCTRL &caps_word &kp PG_DN &kp LEFT &kp DOWN &kp RIGHT &kp DEL &kp BSPC
|
|
//├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤
|
|
&trans &kp LC(Z) &kp LC(X) &kp LC(C) &kp LC(V) &kp LC(S) &trans &trans &kp LC(LS(LEFT)) &kp LC(LS(RIGHT)) &kp LS(HOME) &kp LS(END) &trans &trans
|
|
//├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤
|
|
&trans &trans &trans &trans &trans &trans &trans &trans &trans &trans
|
|
// ╰─────────────┴─────────────┴─────────────┴─────────────┴─────────────╯ ╰─────────────┴─────────────┴─────────────┴─────────────┴─────────────╯
|
|
>;
|
|
|
|
|
|
sensor-bindings =
|
|
<&inc_dec_kp LEFT RIGHT>,
|
|
<&inc_dec_kp DOWN UP>;
|
|
};
|
|
};
|
|
};
|