summaryrefslogtreecommitdiff
path: root/config
diff options
context:
space:
mode:
authorjakobst1n <jakob.stendahl@outlook.com>2024-01-10 08:18:31 +0100
committerjakobst1n <jakob.stendahl@outlook.com>2024-01-10 08:18:31 +0100
commit20c10e8ed1d3710cb83367ca18202e7f160f2506 (patch)
tree99b6f2882572165ae55f7284e08aec82e4989476 /config
parent741ee4dfaa7eea8961159ca40ac1d246ed4bb0b6 (diff)
downloadzmk-config-20c10e8ed1d3710cb83367ca18202e7f160f2506.tar.gz
zmk-config-20c10e8ed1d3710cb83367ca18202e7f160f2506.zip
Improve tapping term and some thumb keys, move utils inside config
Diffstat (limited to 'config')
-rw-r--r--config/bt60_v2.keymap2
-rw-r--r--config/corne.keymap31
-rw-r--r--config/utils/common.h (renamed from config/common.h)4
-rw-r--r--config/utils/homerow.h22
-rw-r--r--config/utils/keypos_42keys.h62
-rw-r--r--config/utils/unicode.h85
6 files changed, 185 insertions, 21 deletions
diff --git a/config/bt60_v2.keymap b/config/bt60_v2.keymap
index f7e079d..5ebceef 100644
--- a/config/bt60_v2.keymap
+++ b/config/bt60_v2.keymap
@@ -9,7 +9,7 @@
#define K_O 23
#define K_A 28
-#include "common.h"
+#include "utils/common.h"
#define DEFAULT 0
#define RAISE 1
diff --git a/config/corne.keymap b/config/corne.keymap
index a3c2d07..9d3b950 100644
--- a/config/corne.keymap
+++ b/config/corne.keymap
@@ -10,7 +10,7 @@
#include <dt-bindings/zmk/bt.h>
#include <dt-bindings/zmk/outputs.h>
-#include "../utils/keypos_42keys.h"
+#include "utils/keypos_42keys.h"
#define K_E LT2
#define K_O RT3
@@ -21,7 +21,7 @@
#define RAISE 2
#define SUPER 3
-#include "common.h"
+#include "utils/common.h"
COMBO(lnx_oe_comb, K_O K_E, DEFAULT, &lnx_no_oe)
COMBO(lnx_ae_comb, K_A K_E, DEFAULT, &lnx_no_ae)
@@ -33,40 +33,35 @@ COMBO(lnx_ao_comb, K_A K_O, DEFAULT, &lnx_no_ao)
compatible = "zmk,behavior-hold-tap";
label = "kp_mo";
#binding-cells = <2>;
- flavor = "hold-preferred";
- tapping-term-ms = <200>;
+ flavor = "tap-preferred";
+ tapping-term-ms = <QUICK_TAP_MS>;
+ quick-tap-ms = <QUICK_TAP_MS>;
+ require-prior-idle-ms = <100>;
bindings = <&mo>, <&kp>;
};
td_alt: td_alt {
compatible = "zmk,behavior-tap-dance";
label = "td_alt";
#binding-cells = <0>;
- tapping-term-ms = <200>;
+ tapping-term-ms = <QUICK_TAP_MS>;
bindings = <&kp LALT>, <&kp RALT>;
};
- td_esc: td_esc {
- compatible = "zmk,behavior-tap-dance";
- label = "td_esc";
- #binding-cells = <0>;
- tapping-term-ms = <200>;
- bindings = <&mt LCTRL ESC>, <&mo SUPER>;
- };
};
keymap {
compatible = "zmk,keymap";
default_layer {
-// ---------------------------------------------------------------------------------------
-// | | Q | W | E | R | T | | Y | U | I | O | P | |
-// | ALT | A | S | D | F | G | | H | J | K | L | ; | ' |
-// | GUI | Z | X | C | V | B | | N | M | , | . | / | |
+// ----------------------------------------------------------------------------------------
+// | | Q | W | E | R | T | | Y | U | I | O | P | |
+// | ALT | A | S | D | F | G | | H | J | K | L | ; | ' |
+// | GUI | Z | X | C | V | B | | N | M | , | . | / | SUPER |
// | TAB |SHIFT| ENT/RSE | | SPC/LWR | BKSP | CTRL/ESC |
label = "Base";
bindings = <
XXX &kp Q &kp W &kp E &kp R &kp T &kp Y &kp U &kp I &kp O &kp P XXX
&td_alt &kp A &kp S &kp D &kp F &kp G &kp H &kp J &kp K &kp L &kp SEMI &kp SQT
- &kp LGUI &kp Z &kp X &kp C &kp V &kp B &kp N &kp M &kp COMMA &kp DOT &kp FSLH XXX
- &kp TAB &kp_mo RAISE RET &kp LSHIFT &kp BSPC &kp_mo LOWER SPACE &td_esc
+ &kp LGUI &kp Z &kp X &kp C &kp V &kp B &kp N &kp M &kp COMMA &kp DOT &kp FSLH &mo SUPER
+ &kp TAB &kp_mo RAISE RET &kp LSHIFT &kp BSPC &kp_mo LOWER SPACE &mt LCTRL ESC
>;
};
lower_layer {
diff --git a/config/common.h b/config/utils/common.h
index e656880..babff13 100644
--- a/config/common.h
+++ b/config/utils/common.h
@@ -25,6 +25,6 @@
};
-#include "../utils/homerow.h"
-#include "../utils/unicode.h"
+#include "homerow.h"
+#include "unicode.h"
diff --git a/config/utils/homerow.h b/config/utils/homerow.h
new file mode 100644
index 0000000..c8fe06f
--- /dev/null
+++ b/config/utils/homerow.h
@@ -0,0 +1,22 @@
+#pragma once
+
+#define MAKE_HRM(NAME, HOLD, TAP) \
+ / { \
+ behaviours { \
+ NAME: NAME { \
+ label = ZMK_HELPER_STRINGIFY(ZB_ ## NAME); \
+ compatible = "zmk,behavior-hold-tap"; \
+ #binding-cells = <2>; \
+ flavor = "balanced"; \
+ tapping-term-ms = <280>; \
+ quick-tap-ms = <QUICK_TAP_MS>; \
+ require-prior-idle-ms = <150>; \
+ bindings = <HOLD>, <TAP>; \
+ hold-trigger-on-release; \
+ }; \
+ }; \
+ };
+
+MAKE_HRM(hml, &kp, &kp)
+MAKE_HRM(hmr, &kp, &kp)
+
diff --git a/config/utils/keypos_42keys.h b/config/utils/keypos_42keys.h
new file mode 100644
index 0000000..21f7052
--- /dev/null
+++ b/config/utils/keypos_42keys.h
@@ -0,0 +1,62 @@
+// https://raw.githubusercontent.com/urob/zmk-nodefree-config/8506dbaaee9b46d200aa553a94b6dbca8560a5e1/keypos_def/keypos_42keys.h
+/* 42 KEY MATRIX / LAYOUT MAPPING
+
+ ╭────────────────────────┬────────────────────────╮ ╭─────────────────────────┬─────────────────────────╮
+ │ 0 1 2 3 4 5 │ 6 7 8 9 10 11 │ │ LT5 LT4 LT3 LT2 LT1 LT0 │ RT0 RT1 RT2 RT3 RT4 RT5 │
+ │ 12 13 14 15 16 17 │ 18 19 20 21 22 23 │ │ LM5 LM4 LM3 LM2 LM1 LM0 │ RM0 RM1 RM2 RM3 RM4 RM5 │
+ │ 24 25 26 27 28 29 │ 30 31 32 33 34 35 │ │ LB5 LB4 LB3 LB2 LB1 LB0 │ RB0 RB1 RB2 RB3 RB4 RB5 │
+ ╰───────────╮ 36 37 38 │ 39 40 41 ╭───────────╯ ╰───────────╮ LH2 LH1 LH0 │ RH0 RH1 RH2 ╭───────────╯
+ ╰────────────┴────────────╯ ╰─────────────┴─────────────╯ */
+
+#pragma once
+
+#define LT0 5 // left-top row
+#define LT1 4
+#define LT2 3
+#define LT3 2
+#define LT4 1
+#define LT5 0
+
+#define RT0 6 // right-top row
+#define RT1 7
+#define RT2 8
+#define RT3 9
+#define RT4 10
+#define RT5 11
+
+#define LM0 17 // left-middle row
+#define LM1 16
+#define LM2 15
+#define LM3 14
+#define LM4 13
+#define LM5 12
+
+#define RM0 18 // right-middle row
+#define RM1 19
+#define RM2 20
+#define RM3 21
+#define RM4 22
+#define RM5 23
+
+#define LB0 29 // left-bottom row
+#define LB1 28
+#define LB2 27
+#define LB3 26
+#define LB4 25
+#define LB5 24
+
+#define RB0 30 // right-bottom row
+#define RB1 31
+#define RB2 32
+#define RB3 33
+#define RB4 34
+#define RB5 35
+
+#define LH0 38 // left thumb keys
+#define LH1 37
+#define LH2 36
+
+#define RH0 39 // right thumb keys
+#define RH1 40
+#define RH2 41
+
diff --git a/config/utils/unicode.h b/config/utils/unicode.h
new file mode 100644
index 0000000..df2b298
--- /dev/null
+++ b/config/utils/unicode.h
@@ -0,0 +1,85 @@
+#pragma once
+
+#define COMBO(name, POS, LAYERS, BINDINGS) \
+ / { \
+ combos { \
+ compatible = "zmk,combos"; \
+ name { \
+ timeout-ms = <50>; \
+ key-positions = <POS>; \
+ layers = <LAYERS>; \
+ bindings = <BINDINGS>; \
+ }; \
+ }; \
+ };
+
+/* ZMK_UNICODE */
+#define UC_LEAD_MACWIN &macro_press &kp LALT // macOS/Windows-Alt-Codes
+#define UC_LEAD_LINUX &macro_tap &kp LS(LC(U)) // Linux
+#define UC_LEAD_WINDOWS &macro_tap &kp RALT &kp U // Windows + WinCompose (default)
+
+#define UC_TRAIL_MACWIN &macro_release &kp LALT // macOS/Windows-Alt-Codes
+#define UC_TRAIL_LINUX &macro_tap &kp SPACE // Linux
+#define UC_TRAIL_WINDOWS &macro_tap &kp RET // Windows + WinCompose (default)
+
+#define UC_MACRO_LINUX(name, unicode_bindings) \
+ / { \
+ macros { \
+ name: name { \
+ compatible = "zmk,behavior-macro"; \
+ label = ZMK_HELPER_STRINGIFY(UC_MACRO_ ## name); \
+ wait-ms = <0>; \
+ tap-ms = <0>; \
+ #binding-cells = <0>; \
+ bindings = <UC_LEAD_LINUX>, <&macro_tap unicode_bindings>, <UC_TRAIL_LINUX>; \
+ }; \
+ }; \
+ };
+#define UC_MACRO_MACWIN(name, unicode_bindings) \
+ / { \
+ macros { \
+ name: name { \
+ compatible = "zmk,behavior-macro"; \
+ label = ZMK_HELPER_STRINGIFY(UC_MACRO_ ## name); \
+ wait-ms = <0>; \
+ tap-ms = <0>; \
+ #binding-cells = <0>; \
+ bindings = <UC_LEAD_MACWIN>, <&macro_tap unicode_bindings>, <UC_TRAIL_MACWIN>; \
+ }; \
+ }; \
+ };
+
+#define UC_MODMORPH(name, uc_binding, shifted_uc_binding) \
+ / { \
+ behaviors { \
+ name: name { \
+ compatible = "zmk,behavior-mod-morph"; \
+ label = ZMK_HELPER_STRINGIFY(UC_MORPH_ ## name); \
+ #binding-cells = <0>; \
+ bindings = <uc_binding>, <shifted_uc_binding>; \
+ mods = <(MOD_LSFT|MOD_RSFT)>; \
+ }; \
+ }; \
+ };
+
+#define ZMK_UNICODE_SINGLE(name, L0, L1, L2, L3) \
+ UC_MACRO(name ## _lower, &kp L0 &kp L1 &kp L2 &kp L3) \
+ UC_MODMORPH(name, &name ## _lower, &none)
+
+#define ZMK_UNICODE_PAIR_LINUX(name, L0, L1, L2, L3, U0, U1, U2, U3) \
+ UC_MACRO_LINUX(name ## _lower, &kp L0 &kp L1 &kp L2 &kp L3) \
+ UC_MACRO_LINUX(name ## _upper, &kp U0 &kp U1 &kp U2 &kp U3) \
+ UC_MODMORPH(name, &name ## _lower, &name ## _upper)
+
+#define ZMK_UNICODE_PAIR_MACWIN(name, L0, L1, L2, L3, U0, U1, U2, U3) \
+ UC_MACRO_MACWIN(name ## _lower, &kp L0 &kp L1 &kp L2 &kp L3) \
+ UC_MACRO_MACWIN(name ## _upper, &kp U0 &kp U1 &kp U2 &kp U3) \
+ UC_MODMORPH(name, &name ## _lower, &name ## _upper)
+
+ZMK_UNICODE_PAIR_MACWIN(mwn_no_ae, N0, N0, E, N6, N0, N0, C, N6)
+ZMK_UNICODE_PAIR_MACWIN(mwn_no_ao, N0, N0, E, N5, N0, N0, C, N5)
+ZMK_UNICODE_PAIR_MACWIN(mwn_no_oe, N0, N0, F, N8, N0, N0, D, N8)
+ZMK_UNICODE_PAIR_LINUX(lnx_no_ae, N0, N0, E, N6, N0, N0, C, N6)
+ZMK_UNICODE_PAIR_LINUX(lnx_no_ao, N0, N0, E, N5, N0, N0, C, N5)
+ZMK_UNICODE_PAIR_LINUX(lnx_no_oe, N0, N0, F, N8, N0, N0, D, N8)
+