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

92 lines
1.8 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-20 21:19:13 -07:00
#include "spellcheck.h"
#include "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
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-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);
//}
}
}
2022-02-06 12:16:11 -08:00
uint32_t layer_state_set_user(uint32_t state) {
set_layer_colors(state);
//uint8_t layer = biton32(state);
return state;
};
2022-02-06 12:00:50 -08:00
// 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-20 21:19:13 -07:00
if (!process_spellcheck(keycode, record)) { 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;
}