diff options
Diffstat (limited to 'users/arkag/arkag.c')
-rw-r--r-- | users/arkag/arkag.c | 234 |
1 files changed, 65 insertions, 169 deletions
diff --git a/users/arkag/arkag.c b/users/arkag/arkag.c index 9e8c7af247..97f84d8f02 100644 --- a/users/arkag/arkag.c +++ b/users/arkag/arkag.c @@ -68,14 +68,14 @@ void reset_color(void) { Color mod_color(Color current_color, bool should_add, uint8_t change_amount) { save_color(underglow); - int addlim = 359 - change_amount; + int addlim = HUE_MAX - change_amount; int sublim = change_amount; int leftovers; if (should_add) { if (current_color.h <= addlim) { current_color.h += change_amount; } else { - leftovers = (359 + change_amount) % 359; + leftovers = (HUE_MAX + change_amount) % HUE_MAX; current_color.h = 0 + leftovers; } } else { @@ -83,7 +83,7 @@ Color mod_color(Color current_color, bool should_add, uint8_t change_amount) { current_color.h -= change_amount; } else { leftovers = change_amount - current_color.h; - current_color.h = 359 - leftovers; + current_color.h = HUE_MAX - leftovers; } } return current_color; @@ -99,7 +99,6 @@ void check_state (void) { if (slept) {rgblight_mode_noeeprom(1);} activated = true; deactivated = false; - slept = false; } fade_interval = velocikey_match_speed(1, 25); if (timer_elapsed(active_timer) < INACTIVE_DELAY) {return;} @@ -111,21 +110,9 @@ void check_state (void) { if (!deactivated) { deactivated = true; activated = false; - slept = false; } velocikey_decelerate(); fade_interval = velocikey_match_speed(1, 25); - if (timer_elapsed(active_timer) < SLEEP_DELAY) {return;} - state = sleeping; - return; - - case sleeping: - if (!slept) { - rgblight_mode_noeeprom(5); - slept = true; - activated = false; - deactivated = false; - } return; case boot: @@ -140,7 +127,7 @@ void fade_rgb (void) { if (timer_elapsed(fade_timer) < fade_interval) {return;} switch (fade_state) { case add_fade: - if (underglow.h == 359) { + if (underglow.h == HUE_MAX) { fade_state = sub_fade; return; } @@ -200,17 +187,17 @@ void set_os (uint8_t os, bool update) { switch (os) { case OS_MAC: set_unicode_input_mode(UC_OSX); - underglow = (Color){ 300, 255, 255 }; + underglow = (Color){ 213, 255, 255 }; mod_primary_mask = MOD_GUI_MASK; break; case OS_WIN: set_unicode_input_mode(UC_WINC); - underglow = (Color){ 180, 255, 255 }; + underglow = (Color){ 128, 255, 255 }; mod_primary_mask = MOD_CTL_MASK; break; case OS_NIX: set_unicode_input_mode(UC_LNX); - underglow = (Color){ 60, 255, 255 }; + underglow = (Color){ 43, 255, 255 }; mod_primary_mask = MOD_CTL_MASK; break; default: @@ -258,6 +245,18 @@ void sec_mod(bool press) { } } +void multi_tap(uint8_t num_of_chars, uint16_t keycode, bool use_shift) { + if (use_shift) { + register_code(KC_LSFT); + } + for (int i = 0; i < num_of_chars; i++) { + tap_code(keycode); + } + if (use_shift) { + unregister_code(KC_LSFT); + } +} + void surround_type(uint8_t num_of_chars, uint16_t keycode, bool use_shift) { if (use_shift) { register_code(KC_LSFT); @@ -283,102 +282,6 @@ void long_keystroke(size_t num_of_keys, uint16_t keys[]) { } } -void dance_grv (qk_tap_dance_state_t *state, void *user_data) { - if (state->count == 1) { - tap_code(KC_GRV); - if (aesthetic) { - tap_code(KC_SPACE); - } - } else if (state->count == 2) { - surround_type(2, KC_GRAVE, false); - } else { - surround_type(6, KC_GRAVE, false); - } -} - -void dance_quot (qk_tap_dance_state_t *state, void *user_data) { - if (state->count == 1) { - tap_code(KC_QUOT); - if (aesthetic) { - tap_code(KC_SPACE); - } - } else if (state->count == 2) { - surround_type(2, KC_QUOTE, false); - } else if (state->count == 3) { - surround_type(2, KC_QUOTE, true); - } -} - -void dance_hyph (qk_tap_dance_state_t *state, void *user_data) { - if (state->count == 1) { - tap_code(KC_MINS); - if (aesthetic) { - tap_code(KC_SPACE); - } - } else if (state->count == 2) { - register_code(KC_LSFT); - tap_code(KC_MINS); - if (aesthetic) { - tap_code(KC_SPACE); - } - unregister_code(KC_LSFT); - } else if (state->count == 3) { - send_unicode_hex_string("2014"); - } -} - -void dance_obrck (qk_tap_dance_state_t *state, void *user_data) { - if (state->count == 1) { - tap_code(KC_LBRC); - if (aesthetic) { - tap_code(KC_SPACE); - } - } else if (state->count == 2) { - register_code(KC_LSFT); - tap_code(KC_9); - if (aesthetic) { - tap_code(KC_SPACE); - } - unregister_code(KC_LSFT); - } -} - -void dance_cbrck (qk_tap_dance_state_t *state, void *user_data) { - if (state->count == 1) { - tap_code(KC_RBRC); - if (aesthetic) { - tap_code(KC_SPACE); - } - } else if (state->count == 2) { - register_code(KC_LSFT); - tap_code(KC_0); - if (aesthetic) { - tap_code(KC_SPACE); - } - unregister_code(KC_LSFT); - } -} - -void dance_game (qk_tap_dance_state_t *state, void *user_data) { - if (state->count == 1) { - - } else if (state->count == 2) { - - } else if (state->count == 3) { - uint8_t layer = biton32(layer_state); - if (layer == _QWERTY) { - layer_off(_QWERTY); - layer_on(_GAMING); - // swirling rgb - rgblight_mode_noeeprom(12); - } else { - layer_off(_GAMING); - layer_on(_QWERTY); - rgblight_mode_noeeprom(1); - } - } -} - void matrix_init_user(void) { current_os = eeprom_read_byte(EECONFIG_USERSPACE); set_os(current_os, false); @@ -402,12 +305,6 @@ void matrix_scan_user(void) { return; } } - SEQ_TWO_KEYS(KC_LSFT, M_PMOD) { - if (current_os == OS_WIN) { - long_keystroke(3, (uint16_t[]){KC_LCTL, KC_LSFT, KC_ESC}); - } else { - } - } SEQ_TWO_KEYS(KC_S, KC_S) { if (current_os == OS_MAC) { long_keystroke(3, (uint16_t[]){KC_LGUI, KC_LSFT, KC_4}); @@ -423,6 +320,18 @@ void matrix_scan_user(void) { } else { } } + SEQ_THREE_KEYS(KC_C, KC_A, KC_E) { + if (current_os == OS_WIN) { + long_keystroke(3, (uint16_t[]){KC_LCTL, KC_LALT, KC_END}); + } else { + } + } + SEQ_THREE_KEYS(KC_C, KC_S, KC_E) { + if (current_os == OS_WIN) { + long_keystroke(3, (uint16_t[]){KC_LCTL, KC_LSFT, KC_ESC}); + } else { + } + } SEQ_FOUR_KEYS(KC_C, KC_A, KC_L, KC_C) { if (current_os == OS_WIN) { SEND_STRING(SS_TAP(X_CALCULATOR)); @@ -460,6 +369,12 @@ void matrix_scan_user(void) { SEQ_TWO_KEYS(KC_E, KC_E) { send_unicode_hex_string("00E9"); } + SEQ_TWO_KEYS(KC_T, KC_I) { + surround_type(4, KC_MINS, true); + } + SEQ_TWO_KEYS(KC_T, KC_B) { + surround_type(4, KC_8, true); + } // end format functions // start fancy functions @@ -468,11 +383,16 @@ void matrix_scan_user(void) { pri_mod(true); tap_code(KC_V); pri_mod(false); - tap_code(KC_RGHT); - tap_code(KC_RGHT); - tap_code(KC_RGHT); + multi_tap(3, KC_RGHT, false); tap_code(KC_ENTER); } + SEQ_THREE_KEYS(KC_T, KC_C, KC_ENT) { + multi_tap(3, KC_GRAVE, false); + pri_mod(true); + tap_code(KC_V); + pri_mod(false); + multi_tap(2, KC_ENTER, false); + } // end fancy functions // start typing functions @@ -483,26 +403,34 @@ void matrix_scan_user(void) { SEQ_TWO_KEYS(KC_D, KC_D) { SEND_STRING(".\\Administrator"); } + SEQ_THREE_KEYS(KC_D, KC_D, KC_D) { + SEND_STRING(".\\Administrator"); + tap_code(KC_TAB); + pri_mod(true); + tap_code(KC_V); + pri_mod(false); + tap_code(KC_ENTER); + } SEQ_THREE_KEYS(KC_L, KC_O, KC_D) { // ಠ__ಠ send_unicode_hex_string("0CA0 005F 005F 0CA0"); } - SEQ_FOUR_KEYS(KC_R, KC_E, KC_P, KC_O) { + SEQ_THREE_KEYS(KC_M, KC_A, KC_P) { SEND_STRING("https://github.com/qmk/qmk_firmware/tree/master/users/arkag"); } - SEQ_FOUR_KEYS(KC_F, KC_L, KC_I, KC_P) { + SEQ_TWO_KEYS(KC_F, KC_F) { // (╯‵Д′)╯彡┻━┻ send_unicode_hex_string("0028 256F 2035 0414 2032 0029 256F 5F61 253B 2501 253B"); } - SEQ_FIVE_KEYS(KC_U, KC_F, KC_L, KC_I, KC_P) { + SEQ_THREE_KEYS(KC_F, KC_F, KC_F) { // ┬─┬ノ( º _ º ノ) send_unicode_hex_string("252C 2500 252C 30CE 0028 0020 00BA 0020 005F 0020 00BA 0020 30CE 0029"); } - SEQ_FIVE_KEYS(KC_L, KC_E, KC_N, KC_N, KC_Y) { + SEQ_THREE_KEYS(KC_L, KC_E, KC_N) { // ( ͡° ͜ʖ ͡°) send_unicode_hex_string("0028 0020 0361 00B0 0020 035C 0296 0020 0361 00B0 0029"); } - SEQ_FIVE_KEYS(KC_S, KC_H, KC_R, KC_U, KC_G) { + SEQ_THREE_KEYS(KC_S, KC_S, KC_S) { // ¯\_(ツ)_/¯ send_unicode_hex_string("00AF 005C 005F 0028 30C4 0029 005F 002F 00AF"); } @@ -541,7 +469,9 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { switch (keycode) { case KC_A ... KC_Z: if (record->event.pressed) { - int shift = rand() % 2; + static int shift_int = 1; + int shift = shift_int % 2; + shift_int++; state = active; velocikey_accelerate(); if (shift == 1){ @@ -578,36 +508,13 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { if (record->event.pressed){ set_os((current_os+1) % _OS_COUNT, true); } - return false; - case M_SPC: - if(record->event.pressed){ - if (aesthetic) { - aesthetic = false; - rgblight_mode_noeeprom(1); - } else { - aesthetic = true; - shifty = false; - // snake mode - rgblight_mode_noeeprom(20); - } - return false; - } - - case M_SFT: - if(record->event.pressed){ - if (shifty) { - shifty = false; - rgblight_mode_noeeprom(1); - } else { - shifty = true; - aesthetic = false; - // knight mode - rgblight_mode_noeeprom(23); - } - return false; + case M_DASH: + if (record->event.pressed){ + send_unicode_hex_string("2014"); } + return false; default: if (record->event.pressed) { @@ -617,14 +524,3 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { return true; } } - -//Tap Dance Definitions -qk_tap_dance_action_t tap_dance_actions[] = { - [TD_GRV_3GRV] = ACTION_TAP_DANCE_FN (dance_grv), - [TD_SING_DOUB] = ACTION_TAP_DANCE_FN (dance_quot), - [TD_HYPH_UNDR] = ACTION_TAP_DANCE_FN (dance_hyph), - [TD_BRCK_PARN_O] = ACTION_TAP_DANCE_FN (dance_obrck), - [TD_BRCK_PARN_C] = ACTION_TAP_DANCE_FN (dance_cbrck), - [TD_LALT_RALT] = ACTION_TAP_DANCE_DOUBLE (KC_LALT, KC_RALT), - [TD_GAME] = ACTION_TAP_DANCE_FN (dance_game), -}; |