#include QMK_KEYBOARD_H #include "version.h" #include "keymap_russian.h" #include "keymap_us_international.h" // Values that should not be saved to git. // There should be a`secrets.h` in this directory // with the following contents: // // #define SECRET_EMAIL "value" // #define SECRET_GMAIL "value" // #define SECRET_SCHOOL_EMAIL "value" #include "secrets.h" // Macro keycodes enum custom_keycodes { M_SHUTDOWN = BETA_SAFE_RANGE, // Macros M_RESETWM, M_RU_CTRL, M_RU_ALT, M_GUI, // Special characters. // M_SPECIAL_TOP and M_SPECIAL_BOTTOM are // bounds used to parse these. Only special // characters should be between them. // // Сharacters here should be in the same // order as they are in the host inteface. M_SPECIAL_TOP, M_SC_GRAVE, M_SC_TILD, M_SC_QUOT, M_SC_LBR, M_SC_RBR, M_SC_LCBR, M_SC_RCBR, M_SC_LKVCH, M_SC_RKVCH, M_SPECIAL_BOTTOM }; // Tapdance keycodes enum tap_dance_codes { TD_WMLAYOUT, TD_SCREENSHOT, TD_OCR }; // LED colors #define LC_OFF LC_HSV( 0, 0, 0) #define LC_GREEN LC_HSV( 85, 203, 158) #define LC_YELLOW LC_HSV( 32, 176, 255) #define LC_PINK LC_HSV(243, 222, 234) #define LC_CYAN LC_HSV(134, 255, 213) #define LC_ORANGE LC_HSV( 14, 255, 255) #define LC_WHITE LC_HSV( 0, 0, 150) #define LC_RED LC_HSV( 0, 255, 145) #define LC_RU_B LC_HSV( 0, 0, 165) #define LC_RU_G LC_HSV(153, 255, 153) #define LC_RU_K LC_HSV( 0, 255, 145) #ifdef ENABLE_HID_SPELLCHECK #include "features/hid_spellcheck.h" #endif #ifdef ENABLE_AUTOCORRECT #include "features/autocorrect/autocorrect.h" #endif #ifdef ENABLE_BETA_LEADER #include "features/leader/beta_leader.h" #endif #include "features/beta_rawhid.h" // Send a special character. // Returns false if character was caught, true otherwise. bool send_special_character(uint16_t keycode) { if ( (keycode > M_SPECIAL_TOP) && (keycode < M_SPECIAL_BOTTOM) ) { hid_send_special_char(keycode - M_SPECIAL_TOP - 1); return false; } return true; } void matrix_scan_user(void) { #ifdef ENABLE_BETA_LEADER beta_qk_leader_check(); #endif } // Include all other parts of configuration #include "layers/layers.c" #include "parts/leader.c" #include "parts/tapdance.c" // Process macros. // Return FALSE to halt key processing, // Return TRUE to allow QMK to handle keypress. bool process_record_user(uint16_t keycode, keyrecord_t *record) { #ifdef ENABLE_BETA_LEADER if (!beta_process_leader(keycode, record)) { return false; } #endif #ifdef ENABLE_HID_SPELLCHECK if (!process_spellcheck(keycode, record)) { return false; } #endif #ifdef ENABLE_AUTOCORRECT if (!process_autocorrection(keycode, record)) { return false; } #endif // Handle special chars if (record->event.pressed) { if (!send_special_character(keycode)) { return false; } } // Handle macros switch (keycode) { case M_RESETWM: if (record->event.pressed) { SEND_STRING(SS_LCTL(SS_LGUI(SS_LSFT(SS_TAP(X_R))))); } return false; // Workaround for one-shot LGUI key. // Using just LGUI with LAYER_DESKTOP as OSL // does not allow you to hold lgui. This does. case M_GUI: if (record->event.pressed) { register_code16(KC_LGUI); } else { unregister_code16(KC_LGUI); } return false; case M_SHUTDOWN: if (record->event.pressed) { SEND_STRING(SS_LGUI(SS_TAP(X_P)) SS_DELAY(100) SS_TAP(X_Y) SS_DELAY(100) SS_TAP(X_ENTER)); } return false; case M_RU_CTRL: if (record->event.pressed) { layer_move(LAYER_MAIN); register_code16(KC_LCTL); } else { unregister_code16(KC_LCTL); layer_move(LAYER_RUSSIAN); } return false; case M_RU_ALT: if (record->event.pressed) { layer_move(LAYER_MAIN); register_code16(KC_LALT); } else { unregister_code16(KC_LALT); layer_move(LAYER_RUSSIAN); } return false; } return true; }