Formatting

master
Mark 2022-02-06 12:16:11 -08:00
parent 85b356d4a1
commit c746af211f
Signed by: Mark
GPG Key ID: AD62BB059C2AAEE4
1 changed files with 237 additions and 198 deletions

View File

@ -219,7 +219,10 @@ void set_layer_color(int layer) {
} }
void rgb_matrix_indicators_user(void) { void rgb_matrix_indicators_user(void) {
if (g_suspend_state || keyboard_config.disable_layer_led) { return; } if (g_suspend_state || keyboard_config.disable_layer_led) {
return;
}
switch (biton32(layer_state)) { switch (biton32(layer_state)) {
case 1: case 1:
set_layer_color(1); set_layer_color(1);
@ -249,38 +252,43 @@ void rgb_matrix_indicators_user(void) {
set_layer_color(10); set_layer_color(10);
break; break;
default: default:
if (rgb_matrix_get_flags() == LED_FLAG_NONE) if (rgb_matrix_get_flags() == LED_FLAG_NONE) {
rgb_matrix_set_color_all(0, 0, 0); rgb_matrix_set_color_all(0, 0, 0);
}
break; 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 ST_MACRO_0: case ST_MACRO_0:
if (record->event.pressed) { if (record->event.pressed) {
SEND_STRING(SS_LCTL(SS_LGUI(SS_LSFT(SS_TAP(X_R))))); SEND_STRING(SS_LCTL(SS_LGUI(SS_LSFT(SS_TAP(X_R)))));
} }
break; break;
case ST_MACRO_1: case ST_MACRO_1:
if (record->event.pressed) { 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)); SEND_STRING(SS_LGUI(SS_TAP(X_P)) SS_DELAY(100) SS_TAP(X_Y) SS_DELAY(100) SS_TAP(X_ENTER));
} }
break; break;
case RU_LAYER: case RU_LAYER:
if (record->event.pressed) { if (record->event.pressed) {
SEND_STRING(SS_LGUI(SS_LSFT(SS_LCTL(SS_TAP(X_9))))); SEND_STRING(SS_LGUI(SS_LSFT(SS_LCTL(SS_TAP(X_9)))));
layer_move(9); layer_move(9);
} }
break; break;
case EN_LAYER: case EN_LAYER:
if (record->event.pressed) { if (record->event.pressed) {
SEND_STRING(SS_LGUI(SS_LSFT(SS_LCTL(SS_TAP(X_0))))); SEND_STRING(SS_LGUI(SS_LSFT(SS_LCTL(SS_TAP(X_0)))));
layer_move(0); layer_move(0);
} }
break; break;
case RU_SYMBOL: case RU_SYMBOL:
if (record->event.pressed) { if (record->event.pressed) {
SEND_STRING(SS_LGUI(SS_LSFT(SS_LCTL(SS_TAP(X_0))))); SEND_STRING(SS_LGUI(SS_LSFT(SS_LCTL(SS_TAP(X_0)))));
@ -290,23 +298,27 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
layer_move(9); layer_move(9);
} }
break; break;
case RGB_SLD: case RGB_SLD:
if (record->event.pressed) { if (record->event.pressed) {
rgblight_mode(1); rgblight_mode(1);
} }
return false; return false;
case HSV_136_138_245: case HSV_136_138_245:
if (record->event.pressed) { if (record->event.pressed) {
rgblight_mode(1); rgblight_mode(1);
rgblight_sethsv(136,138,245); rgblight_sethsv(136,138,245);
} }
return false; return false;
case HSV_24_210_255: case HSV_24_210_255:
if (record->event.pressed) { if (record->event.pressed) {
rgblight_mode(1); rgblight_mode(1);
rgblight_sethsv(24,210,255); rgblight_sethsv(24,210,255);
} }
return false; return false;
case HSV_0_0_255: case HSV_0_0_255:
if (record->event.pressed) { if (record->event.pressed) {
rgblight_mode(1); rgblight_mode(1);
@ -329,29 +341,36 @@ uint32_t layer_state_set_user(uint32_t state) {
case 1: case 1:
ergodox_right_led_1_on(); ergodox_right_led_1_on();
break; break;
case 2: case 2:
ergodox_right_led_2_on(); ergodox_right_led_2_on();
break; break;
case 3: case 3:
ergodox_right_led_3_on(); ergodox_right_led_3_on();
break; break;
case 4: case 4:
ergodox_right_led_1_on(); ergodox_right_led_1_on();
ergodox_right_led_2_on(); ergodox_right_led_2_on();
break; break;
case 5: case 5:
ergodox_right_led_1_on(); ergodox_right_led_1_on();
ergodox_right_led_3_on(); ergodox_right_led_3_on();
break; break;
case 6: case 6:
ergodox_right_led_2_on(); ergodox_right_led_2_on();
ergodox_right_led_3_on(); ergodox_right_led_3_on();
break; break;
case 7: case 7:
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;
} }
@ -378,12 +397,19 @@ uint8_t dance_step(qk_tap_dance_state_t *state);
uint8_t dance_step(qk_tap_dance_state_t *state) { uint8_t dance_step(qk_tap_dance_state_t *state) {
if (state->count == 1) { if (state->count == 1) {
if (state->interrupted || !state->pressed) return SINGLE_TAP; if (state->interrupted || !state->pressed) {
else return SINGLE_HOLD; return SINGLE_TAP;
} else {
return SINGLE_HOLD;
}
} else if (state->count == 2) { } else if (state->count == 2) {
if (state->interrupted) return DOUBLE_SINGLE_TAP; if (state->interrupted) {
else if (state->pressed) return DOUBLE_HOLD; return DOUBLE_SINGLE_TAP;
else return DOUBLE_TAP; } else if (state->pressed) {
return DOUBLE_HOLD;
} else {
return DOUBLE_TAP;
}
} }
return MORE_TAPS; return MORE_TAPS;
} }
@ -407,18 +433,31 @@ void on_dance_0(qk_tap_dance_state_t *state, void *user_data) {
void dance_0_finished(qk_tap_dance_state_t *state, void *user_data) { void dance_0_finished(qk_tap_dance_state_t *state, void *user_data) {
dance_state[0].step = dance_step(state); dance_state[0].step = dance_step(state);
switch (dance_state[0].step) { switch (dance_state[0].step) {
case SINGLE_TAP: register_code16(LGUI(KC_L)); break; case SINGLE_TAP:
case DOUBLE_TAP: register_code16(LGUI(KC_K)); break; register_code16(LGUI(KC_L));
case DOUBLE_SINGLE_TAP: tap_code16(LGUI(KC_L)); register_code16(LGUI(KC_L)); break;
case DOUBLE_TAP:
register_code16(LGUI(KC_K));
break;
case DOUBLE_SINGLE_TAP:
tap_code16(LGUI(KC_L));
register_code16(LGUI(KC_L));
break;
} }
} }
void dance_0_reset(qk_tap_dance_state_t *state, void *user_data) { void dance_0_reset(qk_tap_dance_state_t *state, void *user_data) {
wait_ms(10); wait_ms(10);
switch (dance_state[0].step) { switch (dance_state[0].step) {
case SINGLE_TAP: unregister_code16(LGUI(KC_L)); break; case SINGLE_TAP:
case DOUBLE_TAP: unregister_code16(LGUI(KC_K)); break; unregister_code16(LGUI(KC_L));
case DOUBLE_SINGLE_TAP: unregister_code16(LGUI(KC_L)); break; break;
case DOUBLE_TAP:
unregister_code16(LGUI(KC_K));
break;
case DOUBLE_SINGLE_TAP:
unregister_code16(LGUI(KC_L));
break;
} }
dance_state[0].step = 0; dance_state[0].step = 0;
} }