1
0
Fork 0

[Keymap] arkag Userspace updated (#12183)

Co-authored-by: Alex <alex@turncommerce.com>
This commit is contained in:
Alexander Kagno 2021-03-11 11:01:53 -07:00 committed by GitHub
parent 790f94533c
commit 0ad7833ca4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 93 additions and 237 deletions

View file

@ -10,33 +10,34 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[_QWERTY] = LAYOUT_2u_space_ortho(
KC_ESC, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC,
KC_TAB, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, QUOTE,
KC_TAB, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT,
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT,
M_PMOD, LRALT, M_SMOD, LOWER, RAISE, KC_SPC, MEDIA, FUNCT, XXXXXXX, GAME , KC_LEAD),
M_PMOD, M_SMOD, KC_LALT, MEDIA, SYMBOL, KC_SPC, ARROW, FUNCT, XXXXXXX, KC_RALT, KC_LEAD),
[_RAISE] = LAYOUT_2u_space_ortho(
GRAVE, _______, _______, _______, _______, _______, _______, KC_7, KC_8, KC_9, _______, _______,
_______, OBRACK, CBRACK, KC_EQL, HYPHEN, _______, _______, KC_4, KC_5, KC_6, _______, KC_NLCK,
_______, _______, _______, CEDILLA, _______, KC_COMM, KC_PDOT, KC_1, KC_2, KC_3, KC_BSLS, KC_PENT,
_______, _______, _______, KEEB, _______, _______, KC_0, KC_PSLS, KC_PMNS, KC_PPLS, KC_PAST),
[_LOWER] = LAYOUT_2u_space_ortho(
[_SYMBOL] = LAYOUT_2u_space_ortho(
KC_GRV, KC_LPRN, KC_RPRN, KC_PLUS, KC_UNDS, KC_CIRC, KC_AMPR, KC_7, KC_8, KC_9, _______, _______,
KC_LCBR, KC_LBRC, KC_RBRC, KC_EQL, KC_MINS, KC_ASTR, KC_PIPE, KC_4, KC_5, KC_6, _______, KC_NLCK,
KC_RCBR, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_PDOT, KC_1, KC_2, KC_3, KC_BSLS, KC_PENT,
M_DASH, KC_TILD, _______, KEEB, _______, _______, KC_0, KC_PSLS, KC_PMNS, KC_PPLS, KC_PAST),
[_MEDIA] = LAYOUT_2u_space_ortho(
_______, _______, _______, KC_VOLU, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, KC_MPRV, KC_VOLD, KC_MNXT, _______, _______, _______, _______, _______, _______, _______,
KC_MPLY, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
KC_MUTE, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______),
[_ARROW] = LAYOUT_2u_space_ortho(
_______, _______, _______, _______, _______, _______, _______, _______, KC_UP, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, KC_LEFT, KC_DOWN, KC_RGHT, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, LRALT, _______, _______, _______, _______, _______, _______, _______, _______, _______),
[_MEDIA] = LAYOUT_2u_space_ortho(
_______, _______, _______, _______, _______, _______, _______, _______, KC_VOLU, _______, _______, KC_MUTE,
_______, _______, _______, _______, _______, _______, _______, KC_MPRV, KC_VOLD, KC_MNXT, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, KC_MPLY, _______, _______, _______, _______, _______),
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______),
[_FUNCT] = LAYOUT_2u_space_ortho(
KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
KC_CAPS, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, M_SFT, M_SPC, M_OS ),
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, M_OS ),
[_KEEB] = LAYOUT_2u_space_ortho(
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
@ -44,10 +45,4 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
RGB_M_P, RGB_TOG, RGB_MOD, RGB_VAI, RGB_VAD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, _______, _______, _______,
RESET, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______),
[_GAMING] = LAYOUT_2u_space_ortho(
KC_ESC, KC_F13, KC_1, KC_2, KC_3, KC_4, KC_5, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
KC_TAB, KC_F14, KC_Q, KC_W, KC_E, KC_R, KC_T, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
KC_LSFT, KC_F15, KC_A, KC_S, KC_D, KC_F, KC_G, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
KC_LCTL, KC_F16, KC_Z, KC_X, KC_C, KC_SPC, XXXXXXX, XXXXXXX, XXXXXXX, GAME, XXXXXXX),
};

View file

@ -9,7 +9,7 @@ NKRO_ENABLE = yes
BACKLIGHT_ENABLE = no
AUDIO_ENABLE = no
RGBLIGHT_ENABLE = yes
TAP_DANCE_ENABLE = yes
TAP_DANCE_ENABLE = no
UNICODE_ENABLE = yes
LEADER_ENABLE = yes

View file

@ -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),
};

View file

@ -5,20 +5,9 @@
#define EECONFIG_USERSPACE (uint8_t *)20
#define LRALT TD(TD_LALT_RALT)
#define QUOTE TD(TD_SING_DOUB)
#define GRAVE TD(TD_GRV_3GRV)
#define OBRACK TD(TD_BRCK_PARN_O)
#define CBRACK TD(TD_BRCK_PARN_C)
#define THREE TD(TD_3_GRV_ACT)
#define STRIKE TD(TD_STRK_SHOT)
#define HYPHEN TD(TD_HYPH_UNDR)
#define CEDILLA TD(TD_C_CED)
#define GAME TD(TD_GAME)
#define RAISE MO(1)
#define LOWER MO(2)
#define MEDIA MO(3)
#define SYMBOL MO(1)
#define MEDIA MO(2)
#define ARROW MO(3)
#define FUNCT MO(4)
#define KEEB MO(5)
@ -34,14 +23,15 @@
#define INACTIVE_DELAY 250
#define SLEEP_DELAY 180000
#define HUE_MAX 254
enum {
_QWERTY = 0,
_RAISE,
_LOWER,
_SYMBOL,
_MEDIA,
_ARROW,
_FUNCT,
_KEEB,
_GAMING,
};
typedef enum {
@ -71,7 +61,6 @@ typedef enum {
typedef enum {
active = 0,
inactive,
sleeping,
boot,
} activityState;
@ -79,22 +68,7 @@ enum custom_keycodes {
M_PMOD = SAFE_RANGE,
M_SMOD,
M_OS,
M_SFT,
M_SPC,
};
enum tapdances {
TD_3_GRV_ACT = 0,
TD_C_CED,
TD_GRV_3GRV,
TD_SLSH_HTTP,
TD_SING_DOUB,
TD_HYPH_UNDR,
TD_SPECIAL,
TD_BRCK_PARN_O,
TD_BRCK_PARN_C,
TD_LALT_RALT,
TD_GAME,
M_DASH,
};
void velocikey_accelerate(void);
@ -123,17 +97,8 @@ void pri_mod(bool press);
void sec_mod(bool press);
void multi_tap(uint8_t num_of_chars, uint16_t keycode, bool use_shift);
void surround_type(uint8_t num_of_chars, uint16_t keycode, bool use_shift);
void long_keystroke(size_t num_of_keys, uint16_t keys[]);
void dance_grv (qk_tap_dance_state_t *state, void *user_data);
void dance_quot (qk_tap_dance_state_t *state, void *user_data);
void dance_strk (qk_tap_dance_state_t *state, void *user_data);
void dance_3 (qk_tap_dance_state_t *state, void *user_data);
void dance_c (qk_tap_dance_state_t *state, void *user_data);
void dance_game (qk_tap_dance_state_t *state, void *user_data);
int cur_dance (qk_tap_dance_state_t *state);
void spc_finished (qk_tap_dance_state_t *state, void *user_data);
void spc_reset (qk_tap_dance_state_t *state, void *user_data);