Open CrispyPin opened 1 year ago
Unfortunately, without native ZMK support for unicode, it won't be possible to "hotswap" the OS. The best you can do is to create two separate layers with the corresponding unicode macros for each OS.
For instance, to create both Windows (WinCompose) and Linux versions of a unicode macro, you could do the following:
// activate Linux-mode for helper script
#undef OS_UNICODE_LEAD
#undef OS_UNICODE_TRAIL
#define OS_UNICODE_LEAD ¯o_tap &kp LS(LC(U)) // <- Linux compose sequence
#define OS_UNICODE_TRAIL ¯o_tap &kp SPACE // <- Space terminates unicode input on Linux
// use helper-script to define linux unicode macros, e.g.,
ZMK_UNICODE_PAIR( lin_ae, N0, N0, E, N4, N0, N0, C, N4 )
// switch to Windows-mode (using WinCompose) for helper script
#undef OS_UNICODE_LEAD
#undef OS_UNICODE_TRAIL
#define OS_UNICODE_LEAD ¯o_tap &kp RALT &kp U // <- WinCompose sequence
#define OS_UNICODE_TRAIL ¯o_tap &kp RET // <- Return terminates unicode input on Windows
// use helper-script to define Windows unicode macros, e.g.,
ZMK_UNICODE_PAIR( win_ae, N0, N0, E, N4, N0, N0, C, N4 )
Once you have the unicode macros for both OS, you can add them to a "Linux" and "Windows" layer on your keymap, and then use &to
to toggle between them.
Just for completeness, to activate macOS, you would do:
// activate macOS-mode for helper script
#undef OS_UNICODE_LEAD
#undef OS_UNICODE_TRAIL
#define OS_UNICODE_LEAD ¯o_press &kp LALT // <- macOS compose sequence (must be activated in system preferences)
#define OS_UNICODE_TRAIL ¯o_release &kp LALT // <- Releasing Left-Alt terminates unicode input on macOns
Thank you, I will try setting this up
It would be useful the be able to have a windows and linux version of a unicode macro at the same time, so you can toggle depending on what system the keyboard is connected to