Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for switching unicode method/OS #2

Open
CrispyPin opened this issue Oct 4, 2022 · 3 comments
Open

Support for switching unicode method/OS #2

CrispyPin opened this issue Oct 4, 2022 · 3 comments

Comments

@CrispyPin
Copy link

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

@urob
Copy link
Owner

urob commented Oct 7, 2022

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 &macro_tap &kp LS(LC(U))  // <- Linux compose sequence
#define OS_UNICODE_TRAIL &macro_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 &macro_tap &kp RALT &kp U  // <- WinCompose sequence
#define OS_UNICODE_TRAIL &macro_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.

@urob
Copy link
Owner

urob commented Oct 7, 2022

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 &macro_press &kp LALT  // <- macOS compose sequence (must be activated in system preferences)
#define OS_UNICODE_TRAIL &macro_release &kp LALT  // <- Releasing Left-Alt terminates unicode input on macOns

@CrispyPin
Copy link
Author

Thank you, I will try setting this up

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants