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:40:14 +0100 |
commit | 6cf3e48b4da8953ee2ba2fd71dbfc4a29b9bc0f3 (patch) | |
tree | 70c3bca63ccb0438a5cc5e63ed0caca3da1fe1da /utils | |
parent | a553e2e81a673aeb10bd34d2aca06fd19714137d (diff) | |
download | zmk-config-master.tar.gz zmk-config-master.zip |
Move keymap from main zmk source to separate zmk-config repo.master
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')
-rw-r--r-- | utils/unicode.h | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/utils/unicode.h b/utils/unicode.h new file mode 100644 index 0000000..1965a0d --- /dev/null +++ b/utils/unicode.h @@ -0,0 +1,76 @@ +#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) + |