From d5027a5bf063d2bdc4ab6238f5eef180223f1cac Mon Sep 17 00:00:00 2001 From: Simeon Simeonoff Date: Sat, 17 Aug 2024 20:27:07 +0300 Subject: [PATCH] feat: implement current qmk layout --- .gitignore | 1 + config/behaviors.dtsi | 45 +++++++++ config/custom_behavior.dtsi | 10 -- config/macros.dtsi | 56 +++++++++++ config/splitkb_aurora_corne.conf | 18 ++++ config/splitkb_aurora_corne.keymap | 151 +++++++++++++++-------------- config/west.yml | 6 +- zmk-helpers | 1 + 8 files changed, 206 insertions(+), 82 deletions(-) create mode 100644 config/behaviors.dtsi delete mode 100644 config/custom_behavior.dtsi create mode 100644 config/macros.dtsi create mode 160000 zmk-helpers diff --git a/.gitignore b/.gitignore index 8cc0972..627df97 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ .direnv .venv .west +.DS_Store modules firmware zephyr diff --git a/config/behaviors.dtsi b/config/behaviors.dtsi new file mode 100644 index 0000000..884b0f3 --- /dev/null +++ b/config/behaviors.dtsi @@ -0,0 +1,45 @@ +/* KEY POSITIONS + + ╭─────────────────────────╮ ╭─────────────────────────╮ + │ LT5 LT4 LT3 LT2 LT1 LT0 │ │ RT0 RT1 RT2 RT3 RT4 RT5 │ + │ LM5 LM4 LM3 LM2 LM1 LM0 │ │ RM0 RM1 RM2 RM3 RM4 RM5 │ + │ LB5 LB4 LB3 LB2 LB1 LB0 │ │ RB0 RB1 RB2 RB3 RB4 RB5 │ + ╰───────────╮ LH2 LH1 LH0 │ │ RH0 RH1 RH2 ╭───────────╯ + ╰─────────────╯ ╰─────────────╯ */ + +#define COMBO_TERM_FAST 18 +#define COMBO_TERM_SLOW 30 + +#define COMBO_IDLE_FAST 150 +#define COMBO_IDLE_SLOW 50 + +// implements alt+tab behavior +ZMK_TRI_STATE(alt_tab, + bindings = <&kt RGUI>, <&kp TAB>, <&kt RGUI>; + ignored-key-positions = ; // Ignore Q, ENTER and Arrows +) + +// tap: play/pause | double-tap: next song | tripple-tap: previous song +ZMK_TAP_DANCE(play_np, + tapping-term-ms = <300>; + bindings = <&kp C_PLAY_PAUSE>, <&kp C_NEXT>, <&kp C_PREVIOUS>; +) + +// tap: sticky-shift | shift + tap/ double-tap: caps-word | hold: shift +ZMK_MOD_MORPH(up_shift, + bindings = <&sk LSHFT>, <&caps_word>; + mods = <(MOD_LSFT)>; +) + +// tap: key 2 | quick tap: key 2 | hold: key 1 +ZMK_HOLD_TAP(lkp, + flavor = "tap-preferred"; + tapping-term-ms = <200>; + quick-tap-ms = <200>; + bindings = <&mo>, <&kp>; +) + +//ZMK_COMBO(sh, &ru_sh, LT2 LT1, COL QWR, COMBO_TERM_FAST, COMBO_IDLE_FAST) +//ZMK_COMBO(sht, &ru_shch, LM2 LM1, COL QWR, COMBO_TERM_FAST, COMBO_IDLE_FAST) +//ZMK_COMBO(ch, &ru_ch, LB2 LB1, COL QWR, COMBO_TERM_FAST, COMBO_IDLE_FAST) +//ZMK_COMBO(yu, &ru_yu, RT2 RT1, COL QWR, COMBO_TERM_FAST, COMBO_IDLE_FAST) diff --git a/config/custom_behavior.dtsi b/config/custom_behavior.dtsi deleted file mode 100644 index d464fbd..0000000 --- a/config/custom_behavior.dtsi +++ /dev/null @@ -1,10 +0,0 @@ -/ { - behaviors { - sw_win: swapper { - compatible = "zmk,behavior-tri-state"; - #binding-cells = <0>; - bindings = <&kt RGUI>, <&kp TAB>, <&kt RGUI>; // Cmd, Tab, and release Cmd - ignored-key-positions = <7 9 16 17 18 19 29>; // Ignore arrows, BSPC, ENTER, DEL - }; - }; -}; diff --git a/config/macros.dtsi b/config/macros.dtsi new file mode 100644 index 0000000..9cacd26 --- /dev/null +++ b/config/macros.dtsi @@ -0,0 +1,56 @@ +/* KEY POSITIONS + + ╭─────────────────────────╮ ╭─────────────────────────╮ + │ LT5 LT4 LT3 LT2 LT1 LT0 │ │ RT0 RT1 RT2 RT3 RT4 RT5 │ + │ LM5 LM4 LM3 LM2 LM1 LM0 │ │ RM0 RM1 RM2 RM3 RM4 RM5 │ + │ LB5 LB4 LB3 LB2 LB1 LB0 │ │ RB0 RB1 RB2 RB3 RB4 RB5 │ + ╰───────────╮ LH2 LH1 LH0 │ │ RH0 RH1 RH2 ╭───────────╯ + ╰─────────────╯ ╰─────────────╯ */ + +ZMK_MACRO(cast, + bindings + = <¯o_press &kp LGUI> + , <¯o_tap &kp SPACE> + , <¯o_release &kp LGUI> + ; +) + +ZMK_MACRO(lang, + bindings + = <¯o_press &kp LALT> + , <¯o_tap &kp SPACE> + , <¯o_release &kp LALT> + ; +) + +ZMK_MACRO(prev_d, + bindings = <¯o_tap &kp LBKT &kp D>; +) + +ZMK_MACRO(next_d, + bindings = <¯o_tap &kp RBKT &kp D>; +) + +ZMK_MACRO(prev_c, + bindings = <¯o_tap &kp LBKT &kp C>; +) + +ZMK_MACRO(next_c, + bindings = <¯o_tap &kp RBKT &kp C>; +) + +ZMK_MACRO(next_view, + bindings + = <¯o_press &kp LALT &kp LSHFT> + , <¯o_tap &kp SPACE> + , <¯o_release &kp LALT &kp LSHFT> + ; +) + +ZMK_MACRO(full_view, + bindings + = <¯o_press &kp LALT &kp LSHFT> + , <¯o_tap &kp D> + , <¯o_release &kp LALT &kp LSHFT> + ; +) diff --git a/config/splitkb_aurora_corne.conf b/config/splitkb_aurora_corne.conf index bb2b843..98d8fb0 100644 --- a/config/splitkb_aurora_corne.conf +++ b/config/splitkb_aurora_corne.conf @@ -1,3 +1,21 @@ +# Name +CONFIG_ZMK_KEYBOARD_NAME="Aurora Corne" + +# Set sleep timeout to 30min (30*60*1000ms) +CONFIG_ZMK_SLEEP=y +CONFIG_ZMK_IDLE_SLEEP_TIMEOUT=1800000 + +# Combo config, automated by build script +CONFIG_ZMK_COMBO_MAX_COMBOS_PER_KEY=6 +CONFIG_ZMK_COMBO_MAX_KEYS_PER_COMBO=3 + +# Bluetooth tweaks +CONFIG_ZMK_BLE_EXPERIMENTAL_CONN=y +CONFIG_BT_GATT_ENFORCE_SUBSCRIPTION=n +CONFIG_BT_CTLR_TX_PWR_PLUS_8=y +CONFIG_BT_MAX_CONN=3 +CONFIG_BT_MAX_PAIRED=3 + # Uncomment these two line to add support for encoders to your firmware # CONFIG_EC11=y # CONFIG_EC11_TRIGGER_GLOBAL_THREAD=y diff --git a/config/splitkb_aurora_corne.keymap b/config/splitkb_aurora_corne.keymap index 3dbd8c6..418a429 100644 --- a/config/splitkb_aurora_corne.keymap +++ b/config/splitkb_aurora_corne.keymap @@ -13,81 +13,90 @@ #define NAV 2 #define SYM 3 #define NUM 4 +#define SYS 5 -#include "custom_behavior.dtsi" +#include "zmk-helpers/helper.h" +#include "zmk-helpers/key-labels/42.h" -/ { - keymap { - compatible = "zmk,keymap"; +#include "behaviors.dtsi" +#include "macros.dtsi" - default_layer { -// ----------------------------------------------------------------------------------------- -// | TAB | Q | W | F | P | B | | J | L | U | Y | ; | BKSP | -// | CTRL | A | R | S | T | G | | M | N | E | I | O | ' | -// | SHFT | Z | X | C | D | V | | K | H | , | . | / | SHFT | -// | N/A | ENT | SPC | | ENT | SPC | N/A | - bindings = < - &kp TAB &kp Q &kp W &kp F &kp P &kp B &kp J &kp L &kp U &kp Y &kp SEMI &kp BSPC - &mt LCTL ESC &kp A &kp R &kp S &kp T &kp G &kp M &kp N &kp E &kp I &kp O &kp SQT - &kp LSHFT &kp Z &kp X &kp C &kp D &kp V &kp K &kp H &kp COMMA &kp DOT &kp FSLH &kp RSHFT - &none &kp RET &mo NAV < SYM BSPC &kp SPACE &none - >; - }; +#define XXX &none +#define ___ &trans - qwerty_layer { -// ----------------------------------------------------------------------------------------- -// | TSP | Q | W | E | R | T | | Y | U | I | O | P | TSP | -// | TSP | A | S | D | F | G | | H | J | K | L | ; | TSP | -// | TSP | Z | X | C | V | B | | N | M | TSP | TSP | TSP | TSP | -// | TSP | TSP | TSP | | TSP | TSP | TSP | - bindings = < - &trans &kp Q &kp W &kp E &kp R &kp T &kp Y &kp U &kp I &kp O &kp P &trans - &trans &kp A &kp S &kp D &kp F &kp G &kp H &kp J &kp K &kp L &kp SEMI &trans - &trans &kp Z &kp X &kp C &kp V &kp B &kp N &kp M &trans &trans &trans &trans - &trans &trans &trans &trans &trans &trans - >; - }; +#define CTL_ESC &mt LCTL ESC - nav_layer { -// ----------------------------------------------------------------------------------------- -// | TAB | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 | BKSP | -// | BTCLR| BT1 | BT2 | BT3 | BT4 | BT5 | | LFT | DWN | UP | RGT | | | -// | SHFT | | | | | | | | | | | | | -// | GUI | | SPC | | ENT | | ALT | - bindings = < - &sw_win &kp N1 &kp N2 &kp N3 &kp N4 &kp N5 &kp N6 &kp N7 &kp N8 &kp N9 &kp N0 &kp BSPC - &bt BT_CLR &bt BT_SEL 0 &bt BT_SEL 1 &bt BT_SEL 2 &bt BT_SEL 3 &bt BT_SEL 4 &kp LEFT &kp DOWN &kp UP &kp RIGHT &trans &trans - &kp LSHFT &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans - &kp LGUI &trans &kp SPACE &kp RET &trans &kp RALT - >; - }; +/* Keymap */ +ZMK_CONDITIONAL_LAYER(num, NAV SYM, NUM) // NAV + SYM --> NUM - sym_layer { -// ----------------------------------------------------------------------------------------- -// | TAB | ! | @ | # | $ | % | | ^ | & | * | ( | ) | BKSP | -// | CTRL | | | | | | | - | = | [ | ] | \ | ` | -// | SHFT | | | | | | | _ | + | { | } | "|" | ~ | -// | GUI | | SPC | | ENT | | ALT | - bindings = < - &kp TAB &kp EXCL &kp AT &kp HASH &kp DLLR &kp PRCNT &kp CARET &kp AMPS &kp ASTRK &kp LPAR &kp RPAR &kp BSPC - &kp LCTRL &trans &trans &trans &trans &trans &kp MINUS &kp EQUAL &kp LBKT &kp RBKT &kp BSLH &kp GRAVE - &kp LSHFT &trans &trans &trans &trans &trans &kp UNDER &kp PLUS &kp LBRC &kp RBRC &kp PIPE &kp TILDE - &kp LGUI &trans &kp SPACE &kp RET &trans &kp RALT - >; - }; +ZMK_LAYER(base, +//╭───────────╮ ╭─────────────┬─────────────┬─────────────┬─────────────┬─────────────╮ ╭─────────────┬─────────────┬─────────────┬─────────────┬─────────────╮ ╭───────────╮ + &kp TAB &kp Q &kp W &kp F &kp P &kp B &kp J &kp L &kp U &kp Y &kp SEMI &kp BSPC +//├───────────┤ ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ ├───────────┤ + CTL_ESC &kp A &kp R &kp S &kp T &kp G &kp M &kp N &kp E &kp I &kp O &kp SQT +//├───────────┤ ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ ├───────────┤ + &up_shift &kp Z &kp X &kp C &kp D &kp V &kp K &kp H &kp COMMA &kp DOT &kp FSLH &kp RSHFT +//╰───────────╯ ╰─────────────┼─────────────┴─────────────┼─────────────┼─────────────┤ ├─────────────┼─────────────┼─────────────┴───────────────────────────╯ ╰───────────╯ + XXX &kp RET &mo NAV &lkp SYM BSPC &kp SPACE &mo SYS +// ╰─────────────┴─────────────┴─────────────╯ ╰─────────────┴─────────────┴─────────────╯ +) - num_layer { -// ----------------------------------------------------------------------------------------- -// | TAB | ! | @ | # | $ | % | | ^ | & | * | ( | ) | BKSP | -// | CTRL | | | | | | | - | = | [ | ] | \ | ` | -// | SHFT | | | | | | | _ | + | { | } | "|" | ~ | -// | GUI | | SPC | | ENT | | ALT | - bindings = < - &kp TAB &kp EXCL &kp AT &kp HASH &kp DLLR &kp PRCNT &kp CARET &kp AMPS &kp ASTRK &kp LPAR &kp RPAR &kp BSPC - &kp LCTRL &trans &trans &trans &trans &trans &kp MINUS &kp EQUAL &kp LBKT &kp RBKT &kp BSLH &kp GRAVE - &kp LSHFT &trans &trans &trans &trans &trans &kp UNDER &kp PLUS &kp LBRC &kp RBRC &kp PIPE &kp TILDE - &kp LGUI &trans &kp SPACE &kp RET &trans &kp RALT - >; - }; - }; -}; +ZMK_LAYER(qwerty, +//╭───────────╮ ╭─────────────┬─────────────┬─────────────┬─────────────┬─────────────╮ ╭─────────────┬─────────────┬─────────────┬─────────────┬─────────────╮ ╭───────────╮ + ___ &kp Q &kp W &kp E &kp R &kp T &kp Y &kp U &kp I &kp O &kp P ___ +//├───────────┤ ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ ├───────────┤ + ___ &kp A &kp S &kp D &kp F &kp G &kp H &kp J &kp K &kp L &kp SEMI ___ +//├───────────┤ ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ ├───────────┤ + ___ &kp Z &kp X &kp C &kp V &kp B &kp N &kp M ___ ___ ___ ___ +//╰───────────╯ ╰─────────────┼─────────────┴─────────────┼─────────────┼─────────────┤ ├─────────────┼─────────────┼─────────────┴───────────────────────────╯ ╰───────────╯ + ___ ___ ___ ___ ___ ___ +// ╰─────────────┴─────────────┴─────────────╯ ╰─────────────┴─────────────┴─────────────╯ +) + +ZMK_LAYER(nav, +//╭───────────╮ ╭─────────────┬─────────────┬─────────────┬─────────────┬─────────────╮ ╭─────────────┬─────────────┬─────────────┬─────────────┬─────────────╮ ╭───────────╮ + &alt_tab &prev_c &next_c &lang &cast &kp C_VOL_UP XXX &kp HOME &kp END &prev_d &next_d ___ +//├───────────┤ ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ ├───────────┤ + ___ XXX XXX &sk LALT &sk LGUI &kp C_VOL_DN &kp LEFT &kp DOWN &kp UP &kp RIGHT XXX XXX +//├───────────┤ ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ ├───────────┤ + ___ XXX XXX XXX XXX &play_np XXX &kp PG_UP &kp PG_DN XXX XXX ___ +//╰───────────╯ ╰─────────────┼─────────────┴─────────────┼─────────────┼─────────────┤ ├─────────────┼─────────────┼─────────────┴───────────────────────────╯ ╰───────────╯ + ___ ___ ___ ___ ___ ___ +// ╰─────────────┴─────────────┴─────────────╯ ╰─────────────┴─────────────┴─────────────╯ +) + +ZMK_LAYER(sym, +//╭───────────╮ ╭─────────────┬─────────────┬─────────────┬─────────────┬─────────────╮ ╭─────────────┬─────────────┬─────────────┬─────────────┬─────────────╮ ╭───────────╮ + &kp GRAVE &kp LBKT &kp LBRC &kp LPAR &kp CARET &kp TILDE &kp EXCL &kp STAR &kp RPAR &kp RBRC &kp RBKT ___ +//├───────────┤ ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ ├───────────┤ + ___ &kp MINUS &kp EQUAL &kp AMPS &kp UNDER &kp DLLR &kp HASH &sk RGUI &sk LALT &full_view &next_view XXX +//├───────────┤ ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ ├───────────┤ + ___ &kp PLUS &kp PIPE &kp AT &kp FSLH &kp PRCNT XXX &kp BSLH XXX &kp QMARK XXX ___ +//╰───────────╯ ╰─────────────┼─────────────┴─────────────┼─────────────┼─────────────┤ ├─────────────┼─────────────┼─────────────┴───────────────────────────╯ ╰───────────╯ + ___ ___ ___ ___ ___ ___ +// ╰─────────────┴─────────────┴─────────────╯ ╰─────────────┴─────────────┴─────────────╯ +) + +ZMK_LAYER(num, +//╭───────────╮ ╭─────────────┬─────────────┬─────────────┬─────────────┬─────────────╮ ╭─────────────┬─────────────┬─────────────┬─────────────┬─────────────╮ ╭───────────╮ + XXX &kp KP_N1 &kp KP_N2 &kp KP_N3 &kp KP_N4 &kp KP_N5 &kp KP_N6 &kp KP_N7 &kp KP_N8 &kp KP_N9 &kp KP_N0 ___ +//├───────────┤ ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ ├───────────┤ + ___ &to COL XXX &sk LALT &sk LGUI &kp F11 &kp F12 &sk RGUI &sk LALT XXX &to QWR XXX +//├───────────┤ ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ ├───────────┤ + ___ &kp F1 &kp F2 &kp F3 &kp F4 &kp F5 &kp F6 &kp F7 &kp F8 &kp F9 &kp F10 ___ +//╰───────────╯ ╰─────────────┼─────────────┴─────────────┼─────────────┼─────────────┤ ├─────────────┼─────────────┼─────────────┴───────────────────────────╯ ╰───────────╯ + ___ ___ ___ ___ ___ ___ +// ╰─────────────┴─────────────┴─────────────╯ ╰─────────────┴─────────────┴─────────────╯ +) + +ZMK_LAYER(sys, +//╭───────────╮ ╭─────────────┬─────────────┬─────────────┬─────────────┬─────────────╮ ╭─────────────┬─────────────┬─────────────┬─────────────┬─────────────╮ ╭───────────╮ + XXX &bt BT_SEL 0 &bt BT_SEL 1 &bt BT_SEL 2 &bt BT_SEL 3 &bt BT_CLR ___ ___ ___ ___ ___ ___ +//├───────────┤ ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ ├───────────┤ + ___ ___ ___ ___ ___ &bootloader &bootloader ___ ___ ___ ___ XXX +//├───────────┤ ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ ├───────────┤ + ___ ___ ___ ___ ___ &sys_reset &sys_reset ___ ___ ___ ___ ___ +//╰───────────╯ ╰─────────────┼─────────────┴─────────────┼─────────────┼─────────────┤ ├─────────────┼─────────────┼─────────────┴───────────────────────────╯ ╰───────────╯ + ___ ___ ___ ___ ___ ___ +// ╰─────────────┴─────────────┴─────────────╯ ╰─────────────┴─────────────┴─────────────╯ +) diff --git a/config/west.yml b/config/west.yml index 2464aa4..ece51c9 100644 --- a/config/west.yml +++ b/config/west.yml @@ -4,7 +4,8 @@ manifest: url-base: https://github.com/zmkfirmware - name: dhruvinsh url-base: https://github.com/dhruvinsh - + - name: urob + url-base: https://github.com/urob projects: - name: zmk remote: zmkfirmware @@ -14,5 +15,8 @@ manifest: remote: dhruvinsh revision: main path: modules/tri-state + - name: zmk-helpers + remote: urob + revision: main self: path: config diff --git a/zmk-helpers b/zmk-helpers new file mode 160000 index 0000000..d70db68 --- /dev/null +++ b/zmk-helpers @@ -0,0 +1 @@ +Subproject commit d70db68d1f8013c6f22e208728f97e83fe42da50