diff options
author | jakobst1n <jakob.stendahl@outlook.com> | 2023-11-29 21:40:14 +0100 |
---|---|---|
committer | jakobst1n <jakob.stendahl@outlook.com> | 2023-11-29 21:45:59 +0100 |
commit | 1ff6afebd619213e30acc3b167b44ddfe01fd6f1 (patch) | |
tree | e56cd7f743957cdff0dd6422f372fc53531e5ffa /utils/unicode.h | |
parent | a553e2e81a673aeb10bd34d2aca06fd19714137d (diff) | |
download | zmk-config-1ff6afebd619213e30acc3b167b44ddfe01fd6f1.tar.gz zmk-config-1ff6afebd619213e30acc3b167b44ddfe01fd6f1.zip |
Move keymap from main zmk source to separate zmk-config repo.
Basically adhere to the "new way of doing things". Also, since I made
the keymap the first time, the ckp boards has made it into the core zmk
repo. So it is a hassle to compile without changing things in the source
now.
Diffstat (limited to 'utils/unicode.h')
-rw-r--r-- | utils/unicode.h | 83 |
1 files changed, 83 insertions, 0 deletions
diff --git a/utils/unicode.h b/utils/unicode.h new file mode 100644 index 0000000..f202fda --- /dev/null +++ b/utils/unicode.h @@ -0,0 +1,83 @@ +#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 ¯o_press &kp LALT // macOS/Windows-Alt-Codes +#define UC_LEAD_LINUX ¯o_tap &kp LS(LC(U)) // Linux +#define UC_LEAD_WINDOWS ¯o_tap &kp RALT &kp U // Windows + WinCompose (default) + +#define UC_TRAIL_MACWIN ¯o_release &kp LALT // macOS/Windows-Alt-Codes +#define UC_TRAIL_LINUX ¯o_tap &kp SPACE // Linux +#define UC_TRAIL_WINDOWS ¯o_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>, <¯o_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>, <¯o_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) + |