QMK/keyboards/betalupi_ergodox/keymaps/default/keymap.c

126 lines
2.6 KiB
C
Raw Normal View History

2022-02-06 13:19:32 -08:00
#include "keymap.h"
#include "layers/layers.h"
2022-02-06 12:00:50 -08:00
2022-07-21 17:49:35 -07:00
#ifdef BETA_ENABLE_SPELLCHECK
#include "features/spellcheck.h"
2022-07-21 17:49:35 -07:00
#endif
#include "features/beta_rawhid.h"
2022-07-20 21:19:13 -07:00
2022-07-18 10:37:48 -07:00
// 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"
2022-06-25 18:37:15 -07:00
2022-07-18 10:37:48 -07:00
2022-08-10 09:11:09 -07:00
// 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;
}
2022-07-18 10:37:48 -07:00
LEADER_EXTERNS();
void leader_start(void) { ergodox_right_led_3_on(); }
void leader_end(void) { ergodox_right_led_3_off(); }
2022-07-18 10:37:48 -07:00
void matrix_scan_user(void) {
LEADER_DICTIONARY() {
leading = false;
leader_end();
SEQ_TWO_KEYS(KC_E, KC_M) {
SEND_STRING(SECRET_EMAIL);
}
2022-09-16 10:21:18 -07:00
SEQ_TWO_KEYS(KC_G, KC_M) {
SEND_STRING(SECRET_GMAIL);
}
2022-11-03 10:58:52 -07:00
SEQ_TWO_KEYS(KC_L, KC_I) {
SEND_STRING(SECRET_SCHOOL_EMAIL);
}
2022-08-10 09:11:09 -07:00
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);
}
2022-07-18 10:37:48 -07:00
//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.
2022-02-06 12:00:50 -08:00
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
2022-07-21 17:49:35 -07:00
#ifdef BETA_ENABLE_SPELLCHECK
2022-07-20 21:19:13 -07:00
if (!process_spellcheck(keycode, record)) { return false; }
2022-07-21 17:49:35 -07:00
#endif
2022-08-10 09:11:09 -07:00
// Handle special chars
if (record->event.pressed) {
if (!send_special_character(keycode)) { return false; }
}
// Handle macros
2022-02-06 12:16:11 -08:00
switch (keycode) {
2022-02-09 13:26:46 -08:00
case M_RESETWM:
2022-02-06 12:16:11 -08:00
if (record->event.pressed) {
SEND_STRING(SS_LCTL(SS_LGUI(SS_LSFT(SS_TAP(X_R)))));
}
return false;
2022-02-06 12:16:11 -08:00
2022-02-09 13:26:46 -08:00
case M_SHUTDOWN:
2022-02-06 12:16:11 -08:00
if (record->event.pressed) {
2022-07-20 21:19:20 -07:00
SEND_STRING(SS_LGUI(SS_TAP(X_P)) SS_DELAY(100) SS_TAP(X_Y) SS_DELAY(100) SS_TAP(X_ENTER));
2022-02-06 12:16:11 -08:00
}
return false;
2022-02-06 12:16:11 -08:00
2022-02-09 12:07:34 -08:00
case M_RU_CTRL:
if (record->event.pressed) {
layer_move(LAYER_MAIN);
2022-02-09 12:07:34 -08:00
register_code16(KC_LCTRL);
} else {
2022-02-09 12:07:34 -08:00
unregister_code16(KC_LCTRL);
layer_move(LAYER_RUSSIAN);
}
return false;
2022-07-18 10:16:03 -07:00
case M_RU_ALT:
if (record->event.pressed) {
layer_move(LAYER_MAIN);
2022-07-18 10:16:03 -07:00
register_code16(KC_LALT);
} else {
unregister_code16(KC_LALT);
layer_move(LAYER_RUSSIAN);
2022-07-18 10:16:03 -07:00
}
return false;
2022-02-06 12:16:11 -08:00
}
2022-02-09 11:14:05 -08:00
return true;
}