Removed colemak and language hack
parent
e02056c49d
commit
a7d92cb868
|
@ -6,8 +6,6 @@
|
|||
enum custom_keycodes {
|
||||
M_SHUTDOWN = BETA_SAFE_RANGE,
|
||||
M_RESETWM,
|
||||
RU_LAYER,
|
||||
EN_LAYER,
|
||||
M_RU_CTRL,
|
||||
M_RU_ALT
|
||||
};
|
||||
|
@ -21,56 +19,48 @@ enum tap_dance_codes {
|
|||
enum layer_indices {
|
||||
LAYER_MAIN_IDX = 0,
|
||||
LAYER_RUSSIAN_IDX,
|
||||
LAYER_COLEMAK_IDX,
|
||||
LAYER_NUMPAD_IDX,
|
||||
LAYER_SYMBOLS_IDX,
|
||||
LAYER_ARROWS_IDX,
|
||||
LAYER_FKEYS_IDX,
|
||||
LAYER_DESKTOP_IDX,
|
||||
LAYER_KEYBOARD_IDX,
|
||||
LAYER_SYMBOLS_RU_IDX
|
||||
};
|
||||
|
||||
};
|
||||
// Used to set system keymap
|
||||
enum key_encodings {
|
||||
LANG_NULL, // For layers that don't care about input lang
|
||||
LANG_EN,
|
||||
LANG_RU
|
||||
};
|
||||
enum led_indices {
|
||||
// We have seperate indexes for LEDs because
|
||||
// some layers may not need an led map.
|
||||
// This saves memory by avoiding extra empty led maps.
|
||||
LAYER_COLEMAK_LEDS_IDX = 0,
|
||||
LAYER_RUSSIAN_LEDS_IDX,
|
||||
LAYER_RUSSIAN_LEDS_IDX = 0,
|
||||
LAYER_NUMPAD_LEDS_IDX,
|
||||
LAYER_SYMBOLS_LEDS_IDX,
|
||||
LAYER_ARROWS_LEDS_IDX,
|
||||
LAYER_FKEYS_LEDS_IDX,
|
||||
LAYER_DESKTOP_LEDS_IDX
|
||||
LAYER_DESKTOP_LEDS_IDX,
|
||||
LAYER_SYMBOLS_RU_LEDS_IDX
|
||||
};
|
||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
[LAYER_MAIN_IDX] = LAYER_MAIN,
|
||||
[LAYER_RUSSIAN_IDX] = LAYER_RUSSIAN,
|
||||
[LAYER_COLEMAK_IDX] = LAYER_COLEMAK,
|
||||
[LAYER_NUMPAD_IDX] = LAYER_NUMPAD,
|
||||
[LAYER_SYMBOLS_IDX] = LAYER_SYMBOLS,
|
||||
[LAYER_ARROWS_IDX] = LAYER_ARROWS,
|
||||
[LAYER_FKEYS_IDX] = LAYER_FKEYS,
|
||||
[LAYER_DESKTOP_IDX] = LAYER_DESKTOP,
|
||||
[LAYER_KEYBOARD_IDX] = LAYER_KEYBOARD
|
||||
[LAYER_KEYBOARD_IDX] = LAYER_KEYBOARD,
|
||||
[LAYER_SYMBOLS_RU_IDX] = LAYER_SYMBOLS_RU
|
||||
};
|
||||
const uint8_t PROGMEM ledmap[][DRIVER_LED_TOTAL][3] = {
|
||||
[LAYER_COLEMAK_LEDS_IDX] = LAYER_COLEMAK_LEDS,
|
||||
[LAYER_RUSSIAN_LEDS_IDX] = LAYER_RUSSIAN_LEDS,
|
||||
[LAYER_NUMPAD_LEDS_IDX] = LAYER_NUMPAD_LEDS,
|
||||
[LAYER_SYMBOLS_LEDS_IDX] = LAYER_SYMBOLS_LEDS,
|
||||
[LAYER_ARROWS_LEDS_IDX] = LAYER_ARROWS_LEDS,
|
||||
[LAYER_FKEYS_LEDS_IDX] = LAYER_FKEYS_LEDS,
|
||||
[LAYER_DESKTOP_LEDS_IDX] = LAYER_DESKTOP_LEDS
|
||||
[LAYER_DESKTOP_LEDS_IDX] = LAYER_DESKTOP_LEDS,
|
||||
[LAYER_SYMBOLS_RU_LEDS_IDX] = LAYER_SYMBOLS_RU_LEDS
|
||||
};
|
||||
|
||||
int current_lang = LANG_EN;
|
||||
|
||||
void keyboard_post_init_user(void) {}
|
||||
|
||||
|
||||
|
@ -98,12 +88,12 @@ void rgb_matrix_indicators_user(void) {
|
|||
}
|
||||
|
||||
switch (biton32(layer_state)) {
|
||||
case LAYER_COLEMAK_IDX:
|
||||
set_layer_color(LAYER_COLEMAK_LEDS_IDX);
|
||||
break;
|
||||
case LAYER_RUSSIAN_IDX:
|
||||
set_layer_color(LAYER_RUSSIAN_LEDS_IDX);
|
||||
break;
|
||||
case LAYER_SYMBOLS_RU_IDX:
|
||||
set_layer_color(LAYER_SYMBOLS_RU_LEDS_IDX);
|
||||
break;
|
||||
case LAYER_NUMPAD_IDX:
|
||||
set_layer_color(LAYER_NUMPAD_LEDS_IDX);
|
||||
break;
|
||||
|
@ -127,28 +117,6 @@ 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) {
|
||||
switch (keycode) {
|
||||
case M_RESETWM:
|
||||
|
@ -163,34 +131,13 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
|||
}
|
||||
break;
|
||||
|
||||
case RU_LAYER:
|
||||
if (record->event.pressed) {
|
||||
set_lang(LANG_RU);
|
||||
layer_move(LAYER_RUSSIAN_IDX);
|
||||
}
|
||||
break;
|
||||
|
||||
case EN_LAYER:
|
||||
if (record->event.pressed) {
|
||||
set_lang(LANG_EN);
|
||||
layer_move(LAYER_MAIN_IDX);
|
||||
}
|
||||
break;
|
||||
|
||||
case M_RU_CTRL:
|
||||
if (record->event.pressed) {
|
||||
if (current_lang == LANG_RU) {
|
||||
set_lang_long(LANG_EN, true);
|
||||
layer_move(LAYER_MAIN_IDX);
|
||||
current_lang = LANG_RU;
|
||||
}
|
||||
register_code16(KC_LCTRL);
|
||||
} else {
|
||||
unregister_code16(KC_LCTRL);
|
||||
if (current_lang == LANG_RU) {
|
||||
layer_move(LAYER_RUSSIAN_IDX);
|
||||
set_lang_long(LANG_RU, true);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -208,47 +155,16 @@ uint32_t layer_state_set_user(uint32_t state) {
|
|||
ergodox_right_led_3_off();
|
||||
|
||||
switch (layer) {
|
||||
case LAYER_MAIN_IDX:
|
||||
set_lang(LANG_EN);
|
||||
break;
|
||||
|
||||
case LAYER_RUSSIAN_IDX:
|
||||
set_lang(LANG_RU);
|
||||
ergodox_right_led_2_on();
|
||||
break;
|
||||
|
||||
case LAYER_COLEMAK_IDX:
|
||||
set_lang(LANG_EN);
|
||||
ergodox_right_led_2_on();
|
||||
break;
|
||||
|
||||
case LAYER_NUMPAD_IDX:
|
||||
set_lang(LANG_EN);
|
||||
ergodox_right_led_1_on();
|
||||
break;
|
||||
|
||||
case LAYER_SYMBOLS_IDX:
|
||||
set_lang(LANG_EN);
|
||||
break;
|
||||
|
||||
case LAYER_ARROWS_IDX:
|
||||
set_lang(LANG_EN);
|
||||
break;
|
||||
|
||||
case LAYER_FKEYS_IDX:
|
||||
set_lang(LANG_EN);
|
||||
break;
|
||||
|
||||
case LAYER_DESKTOP_IDX:
|
||||
set_lang(LANG_EN);
|
||||
break;
|
||||
|
||||
case LAYER_KEYBOARD_IDX:
|
||||
set_lang(LANG_NULL);
|
||||
ergodox_right_led_1_on();
|
||||
ergodox_right_led_2_on();
|
||||
ergodox_right_led_3_on();
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -76,9 +76,3 @@
|
|||
#define LC_RU_G LC_HSV(153, 255, 153)
|
||||
#define LC_RU_K LC_HSV( 0, 255, 145)
|
||||
|
||||
|
||||
extern int current_lang;
|
||||
extern rgb_config_t rgb_matrix_config;
|
||||
|
||||
void set_lang(int lang);
|
||||
void set_lang_long(int lang, bool force);
|
|
@ -1,7 +1,6 @@
|
|||
#pragma once
|
||||
|
||||
#include "layers/main.h"
|
||||
#include "layers/colemak.h"
|
||||
#include "layers/numpad.h"
|
||||
#include "layers/symbols.h"
|
||||
#include "layers/arrows.h"
|
||||
|
@ -9,3 +8,4 @@
|
|||
#include "layers/desktop.h"
|
||||
#include "layers/keyboard.h"
|
||||
#include "layers/russian.h"
|
||||
#include "layers/symbols_ru.h"
|
||||
|
|
|
@ -1,39 +0,0 @@
|
|||
#pragma once
|
||||
#include "keymap.h"
|
||||
|
||||
#define LAYER_COLEMAK LAYOUT_ergodox(\
|
||||
KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT,\
|
||||
KC_TRANSPARENT, KC_Q, KC_W, KC_F, KC_P, KC_B, KC_TRANSPARENT,\
|
||||
KC_TRANSPARENT, KC_A, KC_R, KC_S, KC_T, KC_G,\
|
||||
KC_TRANSPARENT, KC_Z, KC_X, KC_C, KC_D, KC_V, 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, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT,\
|
||||
KC_TRANSPARENT, KC_J, KC_L, KC_U, KC_O, KC_TRANSPARENT, KC_TRANSPARENT,\
|
||||
KC_M, KC_N, KC_E, KC_TRANSPARENT, KC_I, KC_TRANSPARENT,\
|
||||
KC_TRANSPARENT, KC_K, KC_H, KC_O, 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\
|
||||
)
|
||||
|
||||
#define LAYER_COLEMAK_LEDS LEDS_ergodox(\
|
||||
LC_PINK, LC_PINK, LC_PINK, LC_PINK, LC_PINK, \
|
||||
LC_OFF, LC_OFF, LC_OFF, LC_OFF, LC_OFF, \
|
||||
LC_OFF, LC_OFF, LC_OFF, LC_OFF, LC_OFF, \
|
||||
LC_OFF, LC_OFF, LC_OFF, LC_OFF, LC_OFF, \
|
||||
LC_OFF, LC_OFF, LC_OFF, LC_OFF, \
|
||||
\
|
||||
LC_PINK, LC_PINK, LC_PINK, LC_PINK, LC_PINK, \
|
||||
LC_OFF, LC_OFF, LC_OFF, LC_OFF, LC_OFF, \
|
||||
LC_OFF, LC_OFF, LC_OFF, LC_OFF, LC_OFF, \
|
||||
LC_OFF, LC_OFF, LC_OFF, LC_OFF, LC_OFF, \
|
||||
LC_OFF, LC_OFF, LC_OFF, LC_OFF \
|
||||
)
|
Loading…
Reference in New Issue