Added russian control hack
parent
863b517059
commit
b5eef54b2c
|
@ -14,7 +14,9 @@ enum custom_keycodes {
|
||||||
ST_MACRO_1,
|
ST_MACRO_1,
|
||||||
RU_LAYER,
|
RU_LAYER,
|
||||||
EN_LAYER,
|
EN_LAYER,
|
||||||
RU_SYMBOL,
|
M_RU_CTRL,
|
||||||
|
M_RU_ALT,
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
enum tap_dance_codes {
|
enum tap_dance_codes {
|
||||||
|
@ -78,14 +80,14 @@ const uint8_t PROGMEM ledmap[][DRIVER_LED_TOTAL][3] = {
|
||||||
[LAYER_DESKTOP_LEDS_IDX] = LAYER_DESKTOP_LEDS
|
[LAYER_DESKTOP_LEDS_IDX] = LAYER_DESKTOP_LEDS
|
||||||
};
|
};
|
||||||
|
|
||||||
extern bool g_suspend_state;
|
int current_lang = LANG_EN;
|
||||||
extern rgb_config_t rgb_matrix_config;
|
|
||||||
|
|
||||||
void keyboard_post_init_user(void) {
|
void keyboard_post_init_user(void) {
|
||||||
rgb_matrix_enable();
|
rgb_matrix_enable();
|
||||||
|
//set_lang(LANG_EN);
|
||||||
}
|
}
|
||||||
|
|
||||||
int current_lang = 0;
|
|
||||||
|
|
||||||
|
|
||||||
void set_layer_color(int layer) {
|
void set_layer_color(int layer) {
|
||||||
|
@ -143,6 +145,27 @@ void rgb_matrix_indicators_user(void) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void set_lang(int lang) { set_lang_long(lang, false); }
|
||||||
|
void set_lang_long(int lang, bool force) {
|
||||||
|
if (current_lang != lang || force) {
|
||||||
|
switch (lang) {
|
||||||
|
case LANG_EN:
|
||||||
|
SEND_STRING(SS_LGUI(SS_LSFT(SS_LCTL(SS_TAP(X_0)))));
|
||||||
|
current_lang = lang;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case LANG_RU:
|
||||||
|
SEND_STRING(SS_LGUI(SS_LSFT(SS_LCTL(SS_TAP(X_9)))));
|
||||||
|
current_lang = lang;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case LANG_NULL:
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||||
switch (keycode) {
|
switch (keycode) {
|
||||||
|
@ -160,25 +183,32 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||||
|
|
||||||
case RU_LAYER:
|
case RU_LAYER:
|
||||||
if (record->event.pressed) {
|
if (record->event.pressed) {
|
||||||
SEND_STRING(SS_LGUI(SS_LSFT(SS_LCTL(SS_TAP(X_9)))));
|
set_lang(LANG_RU);
|
||||||
layer_move(LAYER_RUSSIAN_IDX);
|
layer_move(LAYER_RUSSIAN_IDX);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EN_LAYER:
|
case EN_LAYER:
|
||||||
if (record->event.pressed) {
|
if (record->event.pressed) {
|
||||||
SEND_STRING(SS_LGUI(SS_LSFT(SS_LCTL(SS_TAP(X_0)))));
|
set_lang(LANG_EN);
|
||||||
layer_move(LAYER_MAIN_IDX);
|
layer_move(LAYER_MAIN_IDX);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case RU_SYMBOL:
|
case M_RU_CTRL:
|
||||||
if (record->event.pressed) {
|
if (record->event.pressed) {
|
||||||
SEND_STRING(SS_LGUI(SS_LSFT(SS_LCTL(SS_TAP(X_0)))));
|
if (current_lang == LANG_RU) {
|
||||||
layer_on(LAYER_SYMBOLS_IDX);
|
set_lang_long(LANG_EN, true);
|
||||||
|
layer_move(LAYER_MAIN_IDX);
|
||||||
|
current_lang = LANG_RU;
|
||||||
|
}
|
||||||
|
register_code16(KC_LCTRL);
|
||||||
} else {
|
} else {
|
||||||
SEND_STRING(SS_LGUI(SS_LSFT(SS_LCTL(SS_TAP(X_9)))));
|
unregister_code16(KC_LCTRL);
|
||||||
layer_off(LAYER_SYMBOLS_IDX);
|
if (current_lang == LANG_RU) {
|
||||||
|
layer_move(LAYER_RUSSIAN_IDX);
|
||||||
|
set_lang_long(LANG_RU, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -213,27 +243,6 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void set_lang(int lang) {
|
|
||||||
if (current_lang != lang) {
|
|
||||||
switch (lang) {
|
|
||||||
case LANG_EN:
|
|
||||||
SEND_STRING(SS_LGUI(SS_LSFT(SS_LCTL(SS_TAP(X_0)))));;
|
|
||||||
current_lang = lang;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case LANG_RU:
|
|
||||||
SEND_STRING(SS_LGUI(SS_LSFT(SS_LCTL(SS_TAP(X_9)))));
|
|
||||||
current_lang = lang;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case LANG_NULL:
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t layer_state_set_user(uint32_t state) {
|
uint32_t layer_state_set_user(uint32_t state) {
|
||||||
|
|
||||||
uint8_t layer = biton32(state);
|
uint8_t layer = biton32(state);
|
||||||
|
|
|
@ -44,3 +44,10 @@
|
||||||
#define NO_BSLS_ALT KC_EQUAL
|
#define NO_BSLS_ALT KC_EQUAL
|
||||||
#define LSA_T(kc) MT(MOD_LSFT | MOD_LALT, kc)
|
#define LSA_T(kc) MT(MOD_LSFT | MOD_LALT, kc)
|
||||||
#define BP_NDSH_MAC ALGR(KC_8)
|
#define BP_NDSH_MAC ALGR(KC_8)
|
||||||
|
|
||||||
|
extern int current_lang;
|
||||||
|
extern bool g_suspend_state;
|
||||||
|
extern rgb_config_t rgb_matrix_config;
|
||||||
|
|
||||||
|
void set_lang(int lang);
|
||||||
|
void set_lang_long(int lang, bool force);
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
KC_ESCAPE, KC_1, KC_2, KC_3, KC_4, KC_5, TG(LAYER_NUMPAD_IDX),\
|
KC_ESCAPE, KC_1, KC_2, KC_3, KC_4, KC_5, TG(LAYER_NUMPAD_IDX),\
|
||||||
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_LGUI,\
|
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_LGUI,\
|
||||||
KC_DELETE, KC_A, KC_S, KC_D, KC_F, KC_G,\
|
KC_DELETE, KC_A, KC_S, KC_D, KC_F, KC_G,\
|
||||||
KC_LCTRL, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_TRANSPARENT,\
|
M_RU_CTRL, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_TRANSPARENT,\
|
||||||
MO(LAYER_DESKTOP_IDX), OSL(LAYER_FKEYS_IDX), KC_LALT, KC_LSHIFT, MO(LAYER_ARROWS_IDX),\
|
MO(LAYER_DESKTOP_IDX), OSL(LAYER_FKEYS_IDX), KC_LALT, KC_LSHIFT, MO(LAYER_ARROWS_IDX),\
|
||||||
\
|
\
|
||||||
KC_PSCREEN, LT(LAYER_KEYBOARD_IDX,KC_NO),\
|
KC_PSCREEN, LT(LAYER_KEYBOARD_IDX,KC_NO),\
|
||||||
|
|
|
@ -5,8 +5,8 @@
|
||||||
KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT,\
|
KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT,\
|
||||||
KC_TRANSPARENT, RU_CHE, RU_SHA, RU_IE, RU_ER, RU_TE, RU_YO,\
|
KC_TRANSPARENT, RU_CHE, RU_SHA, RU_IE, RU_ER, RU_TE, RU_YO,\
|
||||||
KC_TRANSPARENT, RU_A, RU_ES, RU_DE, RU_EF, RU_GHE,\
|
KC_TRANSPARENT, RU_A, RU_ES, RU_DE, RU_EF, RU_GHE,\
|
||||||
KC_TRANSPARENT, RU_ZE, RU_YA, RU_TSE, RU_VE, RU_BE, RU_E,\
|
M_RU_CTRL, RU_ZE, RU_YA, RU_TSE, RU_VE, RU_BE, RU_E,\
|
||||||
KC_TRANSPARENT, MO(LAYER_DESKTOP_IDX), KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT,\
|
KC_TRANSPARENT, KC_TRANSPARENT, KC_LALT, KC_TRANSPARENT, KC_TRANSPARENT,\
|
||||||
\
|
\
|
||||||
KC_TRANSPARENT, KC_TRANSPARENT,\
|
KC_TRANSPARENT, KC_TRANSPARENT,\
|
||||||
KC_TRANSPARENT,\
|
KC_TRANSPARENT,\
|
||||||
|
@ -15,12 +15,12 @@
|
||||||
\
|
\
|
||||||
KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, RU_NUM, RU_RUBL, KC_TRANSPARENT,\
|
KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, RU_NUM, RU_RUBL, KC_TRANSPARENT,\
|
||||||
RU_SOFT, RU_U, RU_YU, RU_I, RU_O, RU_SHCH, KC_TRANSPARENT,\
|
RU_SOFT, RU_U, RU_YU, RU_I, RU_O, RU_SHCH, KC_TRANSPARENT,\
|
||||||
RU_HA, RU_ZHE, RU_KA, RU_SYMBOL, RU_EL, KC_TRANSPARENT,\
|
RU_HA, RU_ZHE, RU_KA, KC_TRANSPARENT, RU_EL, KC_TRANSPARENT,\
|
||||||
RU_HARD, RU_EN, RU_EM, RU_PE, RU_YERU, RU_SHTI, KC_TRANSPARENT,\
|
RU_HARD, RU_EN, RU_EM, RU_PE, RU_YERU, RU_SHTI, KC_TRANSPARENT,\
|
||||||
KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT,\
|
KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT,\
|
||||||
\
|
\
|
||||||
KC_TRANSPARENT, EN_LAYER,\
|
KC_NO, EN_LAYER,\
|
||||||
KC_TRANSPARENT,\
|
KC_NO,\
|
||||||
KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT\
|
KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT\
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue