Files
QMK/keyboards/betalupi_ergodox/keymaps/default/keymap.c
2022-11-03 10:58:52 -07:00

126 lines
2.6 KiB
C
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#include "keymap.h"
#include "layers/layers.h"
#ifdef BETA_ENABLE_SPELLCHECK
#include "features/spellcheck.h"
#endif
#include "features/beta_rawhid.h"
// Values that should not be saved to git.
// Create a `secrets.h` in the keymap directory.
//
// It should define the following:
// SECRET_EMAIL
#include "secrets.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_BOTTОM) ) {
hid_send_special_char(keycode - M_SPECIAL_TOP - 1);
return false;
}
return true;
}
LEADER_EXTERNS();
void leader_start(void) { ergodox_right_led_3_on(); }
void leader_end(void) { ergodox_right_led_3_off(); }
void matrix_scan_user(void) {
LEADER_DICTIONARY() {
leading = false;
leader_end();
SEQ_TWO_KEYS(KC_E, KC_M) {
SEND_STRING(SECRET_EMAIL);
}
SEQ_TWO_KEYS(KC_G, KC_M) {
SEND_STRING(SECRET_GMAIL);
}
SEQ_TWO_KEYS(KC_L, KC_I) {
SEND_STRING(SECRET_SCHOOL_EMAIL);
}
SEQ_TWO_KEYS(KC_S, KC_H) {
send_special_character(M_SC_SHRUG);
}
SEQ_THREE_KEYS(KC_Y, KC_A, KC_E) {
send_special_character(M_SC_YAE);
}
SEQ_FOUR_KEYS(KC_L, KC_Y, KC_U, KC_S) {
send_special_character(M_SC_LYUS);
}
SEQ_FOUR_KEYS(KC_B, KC_Y, KC_U, KC_S) {
send_special_character(M_SC_BYUS);
}
//SEQ_ONE_KEY(KC_F) {}
//
//SEQ_TWO_KEYS(KC_A, KC_S) {
// register_code(KC_LGUI);
// register_code(KC_S);
// unregister_code(KC_S);
// unregister_code(KC_LGUI);
//}
}
}
// 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 BETA_ENABLE_SPELLCHECK
if (!process_spellcheck(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;
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_LCTRL);
} else {
unregister_code16(KC_LCTRL);
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;
}