Removed colemak and language hack

master
Mark 2022-07-18 10:01:15 -07:00
parent e02056c49d
commit a7d92cb868
Signed by: Mark
GPG Key ID: AD62BB059C2AAEE4
4 changed files with 16 additions and 145 deletions

View File

@ -6,8 +6,6 @@
enum custom_keycodes { enum custom_keycodes {
M_SHUTDOWN = BETA_SAFE_RANGE, M_SHUTDOWN = BETA_SAFE_RANGE,
M_RESETWM, M_RESETWM,
RU_LAYER,
EN_LAYER,
M_RU_CTRL, M_RU_CTRL,
M_RU_ALT M_RU_ALT
}; };
@ -21,56 +19,48 @@ enum tap_dance_codes {
enum layer_indices { enum layer_indices {
LAYER_MAIN_IDX = 0, LAYER_MAIN_IDX = 0,
LAYER_RUSSIAN_IDX, LAYER_RUSSIAN_IDX,
LAYER_COLEMAK_IDX,
LAYER_NUMPAD_IDX, LAYER_NUMPAD_IDX,
LAYER_SYMBOLS_IDX, LAYER_SYMBOLS_IDX,
LAYER_ARROWS_IDX, LAYER_ARROWS_IDX,
LAYER_FKEYS_IDX, LAYER_FKEYS_IDX,
LAYER_DESKTOP_IDX, LAYER_DESKTOP_IDX,
LAYER_KEYBOARD_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 { enum led_indices {
// We have seperate indexes for LEDs because // We have seperate indexes for LEDs because
// some layers may not need an led map. // some layers may not need an led map.
// This saves memory by avoiding extra empty led maps. // This saves memory by avoiding extra empty led maps.
LAYER_COLEMAK_LEDS_IDX = 0, LAYER_RUSSIAN_LEDS_IDX = 0,
LAYER_RUSSIAN_LEDS_IDX,
LAYER_NUMPAD_LEDS_IDX, LAYER_NUMPAD_LEDS_IDX,
LAYER_SYMBOLS_LEDS_IDX, LAYER_SYMBOLS_LEDS_IDX,
LAYER_ARROWS_LEDS_IDX, LAYER_ARROWS_LEDS_IDX,
LAYER_FKEYS_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] = { const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[LAYER_MAIN_IDX] = LAYER_MAIN, [LAYER_MAIN_IDX] = LAYER_MAIN,
[LAYER_RUSSIAN_IDX] = LAYER_RUSSIAN, [LAYER_RUSSIAN_IDX] = LAYER_RUSSIAN,
[LAYER_COLEMAK_IDX] = LAYER_COLEMAK,
[LAYER_NUMPAD_IDX] = LAYER_NUMPAD, [LAYER_NUMPAD_IDX] = LAYER_NUMPAD,
[LAYER_SYMBOLS_IDX] = LAYER_SYMBOLS, [LAYER_SYMBOLS_IDX] = LAYER_SYMBOLS,
[LAYER_ARROWS_IDX] = LAYER_ARROWS, [LAYER_ARROWS_IDX] = LAYER_ARROWS,
[LAYER_FKEYS_IDX] = LAYER_FKEYS, [LAYER_FKEYS_IDX] = LAYER_FKEYS,
[LAYER_DESKTOP_IDX] = LAYER_DESKTOP, [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] = { const uint8_t PROGMEM ledmap[][DRIVER_LED_TOTAL][3] = {
[LAYER_COLEMAK_LEDS_IDX] = LAYER_COLEMAK_LEDS,
[LAYER_RUSSIAN_LEDS_IDX] = LAYER_RUSSIAN_LEDS, [LAYER_RUSSIAN_LEDS_IDX] = LAYER_RUSSIAN_LEDS,
[LAYER_NUMPAD_LEDS_IDX] = LAYER_NUMPAD_LEDS, [LAYER_NUMPAD_LEDS_IDX] = LAYER_NUMPAD_LEDS,
[LAYER_SYMBOLS_LEDS_IDX] = LAYER_SYMBOLS_LEDS, [LAYER_SYMBOLS_LEDS_IDX] = LAYER_SYMBOLS_LEDS,
[LAYER_ARROWS_LEDS_IDX] = LAYER_ARROWS_LEDS, [LAYER_ARROWS_LEDS_IDX] = LAYER_ARROWS_LEDS,
[LAYER_FKEYS_LEDS_IDX] = LAYER_FKEYS_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) {} void keyboard_post_init_user(void) {}
@ -98,12 +88,12 @@ void rgb_matrix_indicators_user(void) {
} }
switch (biton32(layer_state)) { switch (biton32(layer_state)) {
case LAYER_COLEMAK_IDX:
set_layer_color(LAYER_COLEMAK_LEDS_IDX);
break;
case LAYER_RUSSIAN_IDX: case LAYER_RUSSIAN_IDX:
set_layer_color(LAYER_RUSSIAN_LEDS_IDX); set_layer_color(LAYER_RUSSIAN_LEDS_IDX);
break; break;
case LAYER_SYMBOLS_RU_IDX:
set_layer_color(LAYER_SYMBOLS_RU_LEDS_IDX);
break;
case LAYER_NUMPAD_IDX: case LAYER_NUMPAD_IDX:
set_layer_color(LAYER_NUMPAD_LEDS_IDX); set_layer_color(LAYER_NUMPAD_LEDS_IDX);
break; 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) { bool process_record_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) { switch (keycode) {
case M_RESETWM: case M_RESETWM:
@ -163,34 +131,13 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
} }
break; 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: case M_RU_CTRL:
if (record->event.pressed) { if (record->event.pressed) {
if (current_lang == LANG_RU) { layer_move(LAYER_MAIN_IDX);
set_lang_long(LANG_EN, true);
layer_move(LAYER_MAIN_IDX);
current_lang = LANG_RU;
}
register_code16(KC_LCTRL); register_code16(KC_LCTRL);
} else { } else {
unregister_code16(KC_LCTRL); unregister_code16(KC_LCTRL);
if (current_lang == LANG_RU) { layer_move(LAYER_RUSSIAN_IDX);
layer_move(LAYER_RUSSIAN_IDX);
set_lang_long(LANG_RU, true);
}
} }
break; break;
} }
@ -208,47 +155,16 @@ uint32_t layer_state_set_user(uint32_t state) {
ergodox_right_led_3_off(); ergodox_right_led_3_off();
switch (layer) { 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: case LAYER_NUMPAD_IDX:
set_lang(LANG_EN);
ergodox_right_led_1_on(); ergodox_right_led_1_on();
break; 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: case LAYER_KEYBOARD_IDX:
set_lang(LANG_NULL);
ergodox_right_led_1_on(); ergodox_right_led_1_on();
ergodox_right_led_2_on(); ergodox_right_led_2_on();
ergodox_right_led_3_on(); ergodox_right_led_3_on();
break; break;
default: default:
break; break;
} }

View File

@ -76,9 +76,3 @@
#define LC_RU_G LC_HSV(153, 255, 153) #define LC_RU_G LC_HSV(153, 255, 153)
#define LC_RU_K LC_HSV( 0, 255, 145) #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);

View File

@ -1,7 +1,6 @@
#pragma once #pragma once
#include "layers/main.h" #include "layers/main.h"
#include "layers/colemak.h"
#include "layers/numpad.h" #include "layers/numpad.h"
#include "layers/symbols.h" #include "layers/symbols.h"
#include "layers/arrows.h" #include "layers/arrows.h"
@ -9,3 +8,4 @@
#include "layers/desktop.h" #include "layers/desktop.h"
#include "layers/keyboard.h" #include "layers/keyboard.h"
#include "layers/russian.h" #include "layers/russian.h"
#include "layers/symbols_ru.h"

View File

@ -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 \
)