From 47a6ba5c3ed9309a83d8909343dbbe0c725e1fce Mon Sep 17 00:00:00 2001 From: Rutherther Date: Fri, 6 Jun 2025 20:32:21 +0200 Subject: [PATCH] feat: layers for czech diacritics --- config/cradio.keymap | 145 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 143 insertions(+), 2 deletions(-) diff --git a/config/cradio.keymap b/config/cradio.keymap index 61adde182a2f7badd1c5fc5846acd333ee54bad7..77bf9a62ffe75df9b70c0d1b5938aa14f0d2004e 100644 --- a/config/cradio.keymap +++ b/config/cradio.keymap @@ -12,6 +12,92 @@ #define RIGHT_KEYS 5 6 7 8 9 15 16 17 18 19 25 26 27 28 29 32 33 #define LEFT_KEYS 0 1 2 3 4 10 11 12 13 14 20 21 22 23 24 30 31 +#define DEAD_KEY_MACRO(name, dead_key, symbol) \ +/ { \ + macros { \ + name: name { \ + compatible = "zmk,behavior-macro"; \ + wait-ms = <0>; \ + tap-ms = <0>; \ + #binding-cells = <0>; \ + bindings = <¯o_tap dead_key>, \ + <¯o_tap &kp symbol> ; \ + }; \ + }; \ +}; + +#define SHIFTED_DEAD_KEY_MACRO(name, dead_key, symbol) \ +/ { \ + macros { \ + name: name { \ + compatible = "zmk,behavior-macro"; \ + wait-ms = <0>; \ + tap-ms = <0>; \ + #binding-cells = <0>; \ + bindings = <¯o_tap dead_key>, \ + <¯o_tap &kp LS(symbol)>; \ + }; \ + }; \ +}; + +#define DEAD_KEY_BEHAVIOR(name, nonshifted_name, shifted_name) \ +/ { \ + behaviors { \ + name: name { \ + compatible = "zmk,behavior-mod-morph"; \ + #binding-cells = <0>; \ + bindings = <&nonshifted_name>, <&shifted_name>; \ + mods = <(MOD_LSFT|MOD_RSFT)>; \ + }; \ + }; \ +}; + + +#define CZECH_CHAR_MACRO(name, dead_key, symbol) \ + DEAD_KEY_MACRO(nonshifted_czech_ ## name, dead_key, symbol) \ + SHIFTED_DEAD_KEY_MACRO(shifted_czech_ ## name, dead_key, symbol) \ + DEAD_KEY_BEHAVIOR(czech_ ## name, nonshifted_czech_ ## name, shifted_czech_ ## name) + +#define CZECH_CARET_MACRO(symbol) \ + CZECH_CHAR_MACRO(caret ## _ ## symbol, &kp LS(RA(EQUAL)), symbol) + +#define CZECH_ACUTE_MACRO(symbol) \ + CZECH_CHAR_MACRO(acute ## _ ## symbol, &kp RA(EQUAL), symbol) + +#define CZ_AC_A &czech_acute_A +#define CZ_AC_E &czech_acute_E +#define CZ_AC_I &czech_acute_I +#define CZ_AC_O &czech_acute_O +#define CZ_AC_U &czech_acute_U +#define CZ_AC_Y &czech_acute_Y + +#define CZ_CA_E &czech_caret_E +#define CZ_CA_R &czech_caret_R +#define CZ_CA_S &czech_caret_S +#define CZ_CA_D &czech_caret_D +#define CZ_CA_C &czech_caret_C +#define CZ_CA_T &czech_caret_T +#define CZ_CA_Z &czech_caret_Z +#define CZ_CA_N &czech_caret_N +#define CZ_CA_T &czech_caret_T +#define CZ_CA_U &kp RA(SEMI) + +CZECH_ACUTE_MACRO(A) +CZECH_ACUTE_MACRO(E) +CZECH_ACUTE_MACRO(I) +CZECH_ACUTE_MACRO(O) +CZECH_ACUTE_MACRO(U) +CZECH_ACUTE_MACRO(Y) + +CZECH_CARET_MACRO(E) +CZECH_CARET_MACRO(S) +CZECH_CARET_MACRO(D) +CZECH_CARET_MACRO(C) +CZECH_CARET_MACRO(T) +CZECH_CARET_MACRO(Z) +CZECH_CARET_MACRO(N) +CZECH_CARET_MACRO(R) + / { behaviors { prog_caps: prog_caps { @@ -115,6 +201,11 @@ if-layers = <2 3>; then-layer = <4>; }; + + acute_layer { + if-layers = <2 6>; + then-layer = <7>; + }; }; keymap { @@ -131,7 +222,7 @@ //│ Z │ X │ C │ V │ B │ │ N │ M │ , < │ . > │ / ? │ &kp Z &kp X &kp C &kp V &kp B &kp N &hltr 5 M &comma_excl &dot_ques &kp FSLH //╰──────────┴──────────┴──────────┼──────────┼──────────┤ ├──────────┼──────────┼──────────┴──────────┴──────────╯ - < 3 ESC < 2 SPACE &kp ENTER &kp BSPC + < 3 ESC < 2 SPACE < 6 ENTER &kp BSPC // ╰──────────┴──────────╯ ╰──────────┴──────────╯ >; }; @@ -218,5 +309,55 @@ >; }; + cz_caret { + bindings = < + //╭──────────┬──────────┬──────────┬──────────┬──────────╮ ╭──────────┬──────────┬──────────┬──────────┬──────────╮ + //│ │ │ │ │ │ │ │ │ │ │ │ + &trans &trans CZ_CA_E CZ_CA_R CZ_CA_T &trans CZ_CA_U &trans &trans &trans + //├──────────┼──────────┼──────────┼──────────┼──────────┤ ├──────────┼──────────┼──────────┼──────────┼──────────┤ + //│ │ │ │ │ │ │ │ │ │ │ │ + &trans CZ_CA_S CZ_CA_D &trans &trans &trans &trans &trans &trans &trans + //├──────────┼──────────┼──────────┼──────────┼──────────┤ ├──────────┼──────────┼──────────┼──────────┼──────────┤ + //│ │ │ │ │ │ │ │ │ │ │ │ + CZ_CA_Z &trans CZ_CA_C &trans &trans CZ_CA_N &trans &trans &trans &trans + //╰──────────┴──────────┴──────────┼──────────┼──────────┤ ├──────────┼──────────┼──────────┴──────────┴──────────╯ + &trans &trans &trans &trans + // ╰──────────┴──────────╯ ╰──────────┴──────────╯ + >; + }; + + cz_acute { + bindings = < + //╭──────────┬──────────┬──────────┬──────────┬──────────╮ ╭──────────┬──────────┬──────────┬──────────┬──────────╮ + //│ │ │ │ │ │ │ │ │ │ │ │ + &trans &trans CZ_AC_E &trans &trans CZ_AC_Y CZ_AC_U CZ_AC_I CZ_AC_O &trans + //├──────────┼──────────┼──────────┼──────────┼──────────┤ ├──────────┼──────────┼──────────┼──────────┼──────────┤ + //│ │ │ │ │ │ │ │ │ │ │ │ + CZ_AC_A &trans &trans &trans &trans &trans &trans &trans &trans &trans + //├──────────┼──────────┼──────────┼──────────┼──────────┤ ├──────────┼──────────┼──────────┼──────────┼──────────┤ + //│ │ │ │ │ │ │ │ │ │ │ │ + &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans + //╰──────────┴──────────┴──────────┼──────────┼──────────┤ ├──────────┼──────────┼──────────┴──────────┴──────────╯ + &trans &trans &trans &trans + // ╰──────────┴──────────╯ ╰──────────┴──────────╯ + >; + }; + + /* transparent { */ + /* bindings = < */ + /* //╭──────────┬──────────┬──────────┬──────────┬──────────╮ ╭──────────┬──────────┬──────────┬──────────┬──────────╮ */ + /* //│ │ │ │ │ │ │ │ │ │ │ │ */ + /* &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans */ + /* //├──────────┼──────────┼──────────┼──────────┼──────────┤ ├──────────┼──────────┼──────────┼──────────┼──────────┤ */ + /* //│ │ │ │ │ │ │ │ │ │ │ │ */ + /* &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans */ + /* //├──────────┼──────────┼──────────┼──────────┼──────────┤ ├──────────┼──────────┼──────────┼──────────┼──────────┤ */ + /* //│ │ │ │ │ │ │ │ │ │ │ │ */ + /* &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans */ + /* //╰──────────┴──────────┴──────────┼──────────┼──────────┤ ├──────────┼──────────┼──────────┴──────────┴──────────╯ */ + /* &trans &trans &trans &trans */ + /* // ╰──────────┴──────────╯ ╰──────────┴──────────╯ */ + /* >; */ + /* }; */ }; -}; \ No newline at end of file +};