Custom QMK Library for international layouts.
This library is designed to provide support for international layouts in QMK. Currently Cyrillic ЙЦУКЕН with Mac and PC layouts are supported only, but feel free to ask for another layouts or implement yours in MRs.
This library supports the following features:
- Cyrillic ЙЦУКЕН keycodes (both WIN and MAC symbol layouts), typing them is based on standard unicode mechanisms in QMK
- Every keycode is independent from input sources in your OS and other layouts. In other words, you may use DVORAK for English layer (and shortcuts) and ЙЦУКЕН (or any other configuration) for Russian layer.
- Shift support. E.g. tapping
CYR_YA
will produce 0x044F unicode symbol (which isя
), tappingshift + CYR_YA
will produce 0x042F (which isЯ
) - Other modifiers support for shortcuts. E.g. tapping
ctrl + alt + CYR_YA
will find a keycode in underlying layer and will send it to system (e.g. with ЙЦУКЕН + QWERTY layouts that would be interpreted asctrl + alt + z
) - One-shot mods support, both shifts and other modifiers
- Weak mods support, both shifts and other modifiers
- Caps word support
- Combo support
- Easy installation and usage (can't make it easier than that)
- NO LT() and MT() support. That's kinda tricky to implement. If you need it, please leave your vote in corresponding issue on github
- Ask for your features and layout support in issues on github
-
Enable unicode support in your QMK firmware. Usually you need to add
UNICODE_ENABLE = yes
to yourrules.mk
file. See QMK Unicode Official Documentation for more information. -
Clone
sm_layouts.h
andsm_layouts_keycodes.h
into your QMK keymap directory (next to your keymap.c file) -
Edit your
config.h
3.1. Enable desired layouts (see "List of available layouts and keycodes" below). You can enable several layouts, for example:
#define SM_LAYOUTS_CYR_ENABLED #define SM_LAYOUTS_CYR_WIN_SYMBOLS_ENABLED
3.2. (Optional) Specify shortcut layer. By default, it's
0
(base layer). You can change it by adding#define SM_LAYOUTS_SHORTCUT_LAYER 5
(5 — your desired shortcut layer index) to yourconfig.h
file. -
Edit your
keymap.c
4.1. Add
#include "sm_layouts_keycodes.h"
and#include "sm_layouts.h"
at the top. It's important to includesm_layouts_keycodes.h
first.4.2. Add
if (!process_sm_layouts(keycode, record)) return false;
in the beginning of yourprocess_record_user
function. It should look like this:bool process_record_user(uint16_t keycode, keyrecord_t *record) { if (!process_sm_layouts(keycode, record)) return false; // Rest of your code here return true; }
4.3. Add
SM_LAYOUTS_KEYCODES
to your keymap'senum custom_keycodes
list. It should look like this:enum custom_keycodes { YOUR_CODE_1 = SAFE_RANGE, YOUR_CODE_2, // Rest of your custom keycodes here SM_LAYOUTS_KEYCODES, };
If you didn't have added any custom keycodes before, you need to create one with explicit beginning. It should look like this:
enum custom_keycodes { CUSTOM_KEYCODES_BEGIN = SAFE_RANGE, SM_LAYOUTS_KEYCODES, };
Please note that you can put
SM_LAYOUTS_KEYCODES
anywhere except the beginning of the enum. It's important to explicitly define the beginning of your custom keycodes range withSAFE_RANGE
.4.4 Once you have
SM_LAYOUTS_KEYCODES
in yourenum custom_keycodes
, you can add extra keycodes to your keymapPROGMEM keymaps
. List of available keycodes depends options you have enabled in config.h. See "List of available layouts and keycodes" below for more information. Also check "Copy-paste keymaps", there are typical keyboard layouts, so you can just copy and paste them.
To enable this keycodes add #define SM_LAYOUTS_CYR_ENABLED
to your config.h
file.
This will give you the following keycodes:
CYR_A
—а
orА
(shifted)CYR_B
—б
orБ
(shifted)CYR_V
—в
orВ
(shifted)CYR_G
—г
orГ
(shifted)CYR_D
—д
orД
(shifted)CYR_E
—е
orЕ
(shifted)CYR_YO
—ё
orЁ
(shifted)CYR_ZH
—ж
orЖ
(shifted)CYR_ZZ
—з
orЗ
(shifted)CYR_I
—и
orИ
(shifted)CYR_YY
—й
orЙ
(shifted)CYR_K
—к
orК
(shifted)CYR_L
—л
orЛ
(shifted)CYR_M
—м
orМ
(shifted)CYR_N
—н
orН
(shifted)CYR_O
—о
orО
(shifted)CYR_P
—п
orП
(shifted)CYR_R
—р
orР
(shifted)CYR_SS
—с
orС
(shifted)CYR_T
—т
orТ
(shifted)CYR_U
—у
orУ
(shifted)CYR_F
—ф
orФ
(shifted)CYR_H
—х
orХ
(shifted)CYR_CC
—ц
orЦ
(shifted)CYR_CH
—ч
orЧ
(shifted)CYR_SH
—ш
orШ
(shifted)CYR_SCH
—щ
orЩ
(shifted)CYR_SLD
—ъ
orЪ
(shifted)CYR_YI
—ы
orЫ
(shifted)CYR_SFT
—ь
orЬ
(shifted)CYR_YE
—э
orЭ
(shifted)CYR_YU
—ю
orЮ
(shifted)CYR_YA
—я
orЯ
(shifted)
To enable this keycodes add #define SM_LAYOUTS_CYR_WIN_SYMBOLS_ENABLED
to your config.h
file.
This will give you the following keycodes:
CYR_W1
—1
or!
(shifted)CYR_W2
—2
or"
(shifted)CYR_W3
—3
or№
(shifted)CYR_W4
—4
or;
(shifted)CYR_W5
—5
or%
(shifted)CYR_W6
—6
or:
(shifted)CYR_W7
—7
or?
(shifted)CYR_W8
—8
or*
(shifted)CYR_W9
—9
or(
(shifted)CYR_W0
—0
or)
(shifted)CYR_WDOT
—.
or,
(shifted)CYR_WSLASH
—\
or/
(shifted)
To enable this keycodes add #define SM_LAYOUTS_CYR_MAC_SYMBOLS_ENABLED
to your config.h
file.
This will give you the following keycodes:
CYR_M1
—1
or!
(shifted)CYR_M2
—2
or"
(shifted)CYR_M3
—3
or№
(shifted)CYR_M4
—4
or%
(shifted)CYR_M5
—5
or:
(shifted)CYR_M6
—6
or,
(shifted)CYR_M7
—7
or.
(shifted)CYR_M8
—8
or;
(shifted)CYR_M9
—9
or(
(shifted)CYR_M0
—0
or)
(shifted)CYR_MSLASH
—/
or?
(shifted)CYR_MBRC
—[
or]
(shifted)
CYR_YO, CYR_W1, CYR_W2, CYR_W3, CYR_W4, CYR_W5, CYR_W6, CYR_W7, CYR_W8, CYR_W9, CYR_W0, KC_MINS, KC_EQL, KC_BSPC,
KC_TAB, CYR_YY, CYR_CC, CYR_U, CYR_K, CYR_E, CYR_N, CYR_G, CYR_SH, CYR_SCH, CYR_ZZ, CYR_H, CYR_SLD, CYR_WSLASH,
KC_CAPS_LOCK, CYR_F, CYR_YI, CYR_V, CYR_A, CYR_P, CYR_R, CYR_O, CYR_L, CYR_D, CYR_ZH, CYR_YE, KC_ENTER,
KC_LSFT, CYR_YA, CYR_CH, CYR_SS, CYR_M, CYR_I, CYR_T, CYR_SFT, CYR_B, CYR_YU, CYR_WDOT, KC_RSFT,
CYR_MBRC, CYR_M1, CYR_M2, CYR_M3, CYR_M4, CYR_M5, CYR_M6, CYR_M7, CYR_M8, CYR_M9, CYR_M0, KC_MINS, KC_EQL, KC_BSPC,
KC_TAB, CYR_YY, CYR_CC, CYR_U, CYR_K, CYR_E, CYR_N, CYR_G, CYR_SH, CYR_SCH, CYR_ZZ, CYR_H, CYR_SLD, CYR_YO,
KC_CAPS_LOCK, CYR_F, CYR_YI, CYR_V, CYR_A, CYR_P, CYR_R, CYR_O, CYR_L, CYR_D, CYR_ZH, CYR_YE, KC_ENTER,
KC_LSFT, CYR_YA, CYR_CH, CYR_SS, CYR_M, CYR_I, CYR_T, CYR_SFT, CYR_B, CYR_YU, CYR_MSLASH, KC_RSFT,
CYR_YO, CYR_YY, CYR_CC, CYR_U, CYR_K, CYR_E, CYR_N, CYR_G, CYR_SH, CYR_SCH, CYR_ZZ, CYR_H,
XXXXXXX, CYR_F, CYR_YI, CYR_V, CYR_A, CYR_P, CYR_R, CYR_O, CYR_L, CYR_D, CYR_ZH, CYR_YE,
XXXXXXX, CYR_YA, CYR_CH, CYR_SS, CYR_M, CYR_I, CYR_T, CYR_SFT, CYR_B, CYR_YU, CYR_WDOT, CYR_SLD,
Please note that CYR_SLD and CYR_YO don't have a free key in 3x6, so I moved them a bit. You can change it to your needs.
Normally QMK sends R_OPT + unicode
for macOS. It's not very convenient due to many applications have R_OPT + Number
or R_OPT + A/B/C/D/E/F
shortcuts.
MacOS also accepts unicode symbols with R_OPT + R_SHIFT + unicode
combination.
To make it work you will need to patch unicode.c
or process_unicode.c
(depends on firmware version) file in QMK yourself.
- Open
quantum/process_keycode/process_unicode.c
andquantum/unicode/unicode.c
(if you have it in your QMK directory). - Replace
register_code(UNICODE_KEY_MAC);
withregister_code(KC_LEFT_ALT); register_code(KC_LEFT_SHIFT);
- Replace every
unregister_code(UNICODE_KEY_MAC);
withunregister_code(KC_LEFT_SHIFT); unregister_code(KC_LEFT_ALT);
- Rebuild your firmware and flash it to your keyboard.
Go to page chrome://extensions/shortcuts
and update shortcuts for your extensions.
There is an option Focus on inactive dialogs
that uses ALT + SHIFT + A
shortcut. You'd better change it to another one.
Otherwise, you will have a conflict with R_ALT + R_SHIFT + A
unicode combination.
Please check your applications shortcuts and update them if needed. In my cases I had to review shortcuts for JetBrains IDEs, iTerm2, and VSCode.