add windows compatibility mode for swedish unicode macros

This commit is contained in:
Crispy 2022-10-15 13:17:11 +02:00
parent db6d508daa
commit eaec9128a5

View file

@ -4,51 +4,79 @@
#define HOST_OS 1
#include "../../../../zmk-nodefree-config/helper.h"
#include "../../../../zmk-nodefree-config/international_chars/swedish.dtsi"
#define L0 0
#define L1 1
#define L2 2
#define L3 3
#define TOKI 4
#define GAME 5
// activate Linux-mode for helper script
// #undef OS_UNICODE_LEAD
// #undef OS_UNICODE_TRAIL
// #define OS_UNICODE_LEAD &macro_tap &kp LS(LC(U)) // <- Linux compose sequence
// #define OS_UNICODE_TRAIL &macro_tap &kp SPACE // <- Space terminates unicode input on Linux
ZMK_UNICODE_PAIR(lin_ae, N0, N0, E, N4, N0, N0, C, N4)
ZMK_UNICODE_PAIR(lin_ao, N0, N0, E, N5, N0, N0, C, N5)
ZMK_UNICODE_PAIR(lin_oe, N0, N0, F, N6, N0, N0, D, N6)
ZMK_UNICODE_SINGLE(multi_o, A, N6, N6, E) // multiocular o
// switch to Windows-mode (using WinCompose) for helper script
#undef OS_UNICODE_LEAD
#undef OS_UNICODE_TRAIL
#define OS_UNICODE_LEAD &macro_tap &kp RALT &kp U // <- WinCompose sequence
#define OS_UNICODE_TRAIL &macro_tap &kp RET // <- Return terminates unicode input on Windows
ZMK_UNICODE_PAIR(win_ae, N0, N0, E, N4, N0, N0, C, N4)
ZMK_UNICODE_PAIR(win_ao, N0, N0, E, N5, N0, N0, C, N5)
ZMK_UNICODE_PAIR(win_oe, N0, N0, F, N6, N0, N0, D, N6)
#define BASE 0
#define SYM 1
#define NAV 2
#define META 3
#define TOKI 4
#define GAME 5
#define WINDOWS 6
#define WIN_UNI 7
/ {
conditional_layers {
compatible = "zmk,conditional-layers";
windows_unicode {
if-layers = <SYM WINDOWS>;
then-layer = <WIN_UNI>;
};
};
keymap {
compatible = "zmk,keymap";
layer_0 {
l_base {
bindings = <
&kp ESC &kp W &kp F &kp P &kp B &kp J &kp L &kp U &kp Y &kp BACKSPACE
&kp A &kp R &kp S &kp T &kp G &kp M &kp N &kp E &kp I &kp O
&kp LCTRL &kp X &kp C &kp D &kp V &kp K &kp H &kp Z &kp Q &kp LALT
&kp SPACE &mo L1 &kp LWIN &mo L2 &kp LSHIFT &kp RET
&kp SPACE &mo SYM &kp LWIN &mo NAV &kp LSHIFT &kp RET
>;
};
// numbers + symbols + non english letters
layer_1 {
l_sym {
bindings = <
&kp TAB &kp GRAVE &kp LBKT &kp RBKT &none &none &sv_ao &sv_ae &sv_oe &kp DEL
&kp TAB &kp GRAVE &kp LBKT &kp RBKT &none &none &lin_ao &lin_ae &lin_oe &kp DEL
&kp N1 &kp N2 &kp N3 &kp N4 &kp N5 &kp N6 &kp N7 &kp N8 &kp N9 &kp N0
&trans &kp SQT &kp SLASH &kp BSLH &kp EQUAL &kp MINUS &kp SEMI &kp COMMA &kp DOT &trans
&trans &trans &trans &mo L3 &trans &trans
&trans &trans &trans &mo META &trans &trans
>;
// ' " / ? \ | = + - _ ; : , < . >
};
// F keys + navigation
layer_2 {
l_nav {
bindings = <
&kp F1 &kp F2 &kp F3 &kp F4 &kp F5 &kp PG_UP &kp HOME &kp UP &kp END &kp PSCRN
&kp F6 &kp F7 &kp F8 &kp F9 &kp F10 &kp PG_DN &kp LEFT &kp DOWN &kp RIGHT &kp K_CMENU
&trans &kp F11 &kp F12 &kp F13 &kp F14 &kp F15 &kp F16 &kp F17 &kp F18 &trans
&trans &mo L3 &trans &trans &trans &trans
&trans &mo META &trans &trans &trans &trans
>;
};
// media + bluetooth + future layer toggles
layer_3 {
l_meta {
bindings = <
&trans &none &none &tog GAME &tog TOKI &kp C_BRI_UP &kp C_PREV &kp C_NEXT &kp C_VOL_UP &trans
&trans &none &tog WINDOWS &tog GAME &tog TOKI &kp C_BRI_UP &kp C_PREV &kp C_NEXT &kp C_VOL_UP &trans
&none &none &none &none &none &kp C_BRI_DN &kp C_PLAY &kp C_STOP &kp C_VOL_DN &multi_o
&trans &none &bt BT_SEL 0 &bt BT_NXT &bt BT_CLR &none &none &none &none &trans
&trans &trans &trans &trans &trans &trans
@ -57,7 +85,7 @@ ZMK_UNICODE_SINGLE(multi_o, A, N6, N6, E) // multiocular o
// toki pona
l_toki {
bindings = <
&trans &kp P &kp W &kp U &none &to L0 &kp E &kp S &kp J &trans
&trans &kp P &kp W &kp U &none &to BASE &kp E &kp S &kp J &trans
&kp N &kp L &kp I &kp A &none &none &kp O &kp T &kp M &kp K
&trans &none &kp QMARK &kp EXCL &none &none &kp DOT &kp COMMA &none &none
&trans &trans &none &none &trans &trans
@ -69,7 +97,23 @@ ZMK_UNICODE_SINGLE(multi_o, A, N6, N6, E) // multiocular o
&kp ESC &kp Q &kp W &kp E &kp R &none &none &kp UP &none &kp BSPC
&kp LSHFT &kp A &kp S &kp D &kp F &none &kp LEFT &kp DOWN &kp RIGHT &none
&kp LCTRL &kp Z &kp X &kp C &kp V &none &none &none &none &none
&kp LALT &kp SPACE &to L0 &to L0 &none &kp RET
&kp LALT &kp SPACE &to BASE &to BASE &none &kp RET
>;
};
l_windows {
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 &trans &trans
>;
};
l_win_unicode {
bindings = <
&trans &trans &trans &trans &trans &trans &win_ao &win_ae &win_oe &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
>;
};
};