mirror of
https://github.com/qmk/qmk_firmware
synced 2024-11-10 05:59:44 +00:00
Keymap: Added Leader Key Functionality (#4025)
* deleting arkag branch, forcibly moving changes over to master * fade_color function added, not tested * added half functions some stuff * surround_type function implemented and working. * added flashing function and removed fading, flashing supports infinite flashing along with controlled number flashes * added a fade state machine and functionality * build optimizations, changed fade to bounce between bounds rather than roll over, added a HALMAK layout * changes to sleep breath function, changed how I will switch to HALMAK * support for halmak added * support for activity detection added, condensed fading and flashing state machines, removed support for HALMAK and COLEMAK because arkag is stupid * changed sleep and inactive behaviors, now the color shifting reverses on state change, yay! save_color and reset_color are made to enable layer color changing to look cooler. * reformatted some if statements in state detection * changes to force fade to pause on boot, or plug in. * Attempting to move over to userspace, pushing to repository for help * userspace stuff.... * userspace stuff.... * layout changes, working userspace, Removed left side shift and replaced it with a MT() for LSFT and SPC. Userspace seems to be working properly now! HURRAY * Layout change Removed space/shift and reset modifiers to what they were originally. Added homerow modifiers. * Removed excessive tabs in files * Moved mods on homerow around... * changes recommended by @drashna * removed homerow mods, more flashy lighting! * changed delays for lighting. * velocikey code retro fit into userspace to match typing speed currently "working" but isn't as reactive as I want. * Readme and other documentation hidden throughout code * Added a pretty picture * pretty picture actually added * More readme updates * Velocikey now working inside my userspace! * Changed repo macro and fixed readme * Removed media layer, moved media control to LAZY layer * fixed more merge issues when I had to merge... * implemented some leader key stuff * removed merge garbage... * changes requested by @drashna, leader key switch from macros
This commit is contained in:
parent
170507896d
commit
3875d6f581
5 changed files with 117 additions and 166 deletions
|
@ -3,5 +3,5 @@
|
|||
// save me space!
|
||||
#define NO_ACTION_MACRO
|
||||
#define NO_ACTION_FUNCTION
|
||||
#define DISABLE_LEADER
|
||||
// #define DISABLE_LEADER
|
||||
#define NO_MUSIC_MODE
|
||||
|
|
|
@ -8,10 +8,10 @@
|
|||
|
||||
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_LEAD, 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_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_UP, KC_ENT,
|
||||
M_PMOD, LRALT, M_SMOD, LOWER, RAISE, KC_SPC, KC_SLSH, LAZY, KC_LEFT, KC_DOWN, KC_RGHT),
|
||||
M_PMOD, LRALT, M_SMOD, LOWER, RAISE, KC_SPC, KC_SLSH, KC_BSLS, KC_LEFT, KC_DOWN, KC_RGHT),
|
||||
|
||||
[_RAISE] = LAYOUT_2u_space_ortho(
|
||||
GRAVE, KC_1, KC_2, THREE, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, _______,
|
||||
|
@ -20,10 +20,10 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||
_______, _______, _______, KEEB, _______, _______, _______, M_OS, KC_PSLS, KC_PMNS, KC_PAST),
|
||||
|
||||
[_LOWER] = LAYOUT_2u_space_ortho(
|
||||
_______, _______, _______, _______, _______, _______, _______, M_ULIN, M_ITAL, _______, M_P_B, M_C_A_D,
|
||||
_______, _______, STRIKE, _______, _______, _______, _______, _______, _______, _______, _______, _______,
|
||||
KC_CAPS, KC_DEL, _______, _______, _______, M_BOLD, _______, _______, _______, _______, KC_PGUP, _______,
|
||||
_______, _______, _______, _______, _______, _______, KC_BSLS, M_CALC, KC_HOME, KC_PGDN, KC_END),
|
||||
KC_ESC, _______, _______, _______, _______, _______, _______, _______, _______, _______, M_P_B, M_C_A_D,
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
|
||||
KC_CAPS, KC_DEL, _______, _______, _______, _______, _______, _______, _______, _______, KC_PGUP, _______,
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, KC_HOME, KC_PGDN, KC_END),
|
||||
|
||||
[_KEEB] = 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,
|
||||
|
@ -35,5 +35,5 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||
_______, _______, _______, _______, _______, M_TM, _______, M_SNIPT, M_SHRUG, _______, _______, KC_MUTE,
|
||||
_______, _______, _______, _______, _______, M_GGT, _______, M_UF, M_LOD, M_REPO, _______, _______,
|
||||
_______, _______, _______, _______, _______, _______, _______, M_TF, M_LENNY, _______, KC_VOLU, KC_MPLY,
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, KC_MPRV, KC_VOLD, KC_MNXT),
|
||||
_______, _______, _______, _______, _______, _______, M_CALC, _______, KC_MPRV, KC_VOLD, KC_MNXT),
|
||||
};
|
||||
|
|
|
@ -11,6 +11,7 @@ AUDIO_ENABLE = no
|
|||
RGBLIGHT_ENABLE = yes
|
||||
TAP_DANCE_ENABLE = yes
|
||||
UNICODE_ENABLE = yes
|
||||
LEADER_ENABLE = yes
|
||||
|
||||
# save me space!
|
||||
EXTRAFLAGS += -flto
|
||||
|
|
|
@ -370,10 +370,115 @@ void matrix_init_user(void) {
|
|||
set_os(current_os, false);
|
||||
}
|
||||
|
||||
LEADER_EXTERNS();
|
||||
|
||||
void matrix_scan_user(void) {
|
||||
check_state();
|
||||
flash_rgb();
|
||||
fade_rgb();
|
||||
LEADER_DICTIONARY() {
|
||||
leading = false;
|
||||
leader_end();
|
||||
|
||||
// begin OS functions
|
||||
SEQ_TWO_KEYS(KC_P, KC_B) {
|
||||
if (current_os == OS_WIN) {
|
||||
SEND_STRING(SS_DOWN(X_LGUI) SS_TAP(X_PAUSE) SS_UP(X_LGUI));
|
||||
} else {
|
||||
}
|
||||
}
|
||||
SEQ_THREE_KEYS(KC_C, KC_A, KC_D) {
|
||||
if (current_os == OS_WIN) {
|
||||
SEND_STRING(SS_DOWN(X_LCTRL) SS_DOWN(X_LALT) SS_TAP(X_DELETE) SS_UP(X_LALT) SS_UP(X_LCTRL));
|
||||
} else {
|
||||
}
|
||||
}
|
||||
SEQ_FOUR_KEYS(KC_C, KC_A, KC_L, KC_C) {
|
||||
if (current_os == OS_WIN) {
|
||||
SEND_STRING(SS_TAP(X_CALCULATOR));
|
||||
} else if (current_os == OS_MAC) {
|
||||
SEND_STRING(SS_DOWN(X_LGUI) SS_TAP(X_SPACE) SS_UP(X_LGUI) "calculator" SS_TAP(X_ENTER));
|
||||
}
|
||||
}
|
||||
// end OS functions
|
||||
|
||||
// begin format functions
|
||||
SEQ_ONE_KEY(KC_B) {
|
||||
surround_type(4, KC_8, true);
|
||||
}
|
||||
SEQ_ONE_KEY(KC_I) {
|
||||
surround_type(2, KC_8, true);
|
||||
}
|
||||
SEQ_ONE_KEY(KC_U) {
|
||||
surround_type(4, KC_MINS, true);
|
||||
}
|
||||
SEQ_ONE_KEY(KC_S) {
|
||||
surround_type(4, KC_GRAVE, true);
|
||||
}
|
||||
SEQ_TWO_KEYS(KC_S, KC_S) {
|
||||
if (current_os == OS_MAC) {
|
||||
long_keystroke(3, (uint16_t[]){KC_LGUI, KC_LSFT, KC_4});
|
||||
} else if (current_os == OS_WIN) {
|
||||
long_keystroke(3, (uint16_t[]){KC_LGUI, KC_LSFT, KC_S});
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
SEQ_ONE_KEY(KC_C) {
|
||||
surround_type(2, KC_GRAVE, false);
|
||||
}
|
||||
SEQ_TWO_KEYS(KC_C, KC_C) {
|
||||
surround_type(6, KC_GRAVE, false);
|
||||
}
|
||||
// end format functions
|
||||
|
||||
// start fancy functions
|
||||
SEQ_THREE_KEYS(KC_C, KC_C, KC_C) {
|
||||
surround_type(6, KC_GRAVE, false);
|
||||
pri_mod(true);
|
||||
tap_key(KC_V);
|
||||
pri_mod(false);
|
||||
tap_key(KC_RGHT);
|
||||
tap_key(KC_RGHT);
|
||||
tap_key(KC_RGHT);
|
||||
tap_key(KC_ENTER);
|
||||
}
|
||||
// end fancy functions
|
||||
|
||||
// start typing functions
|
||||
SEQ_TWO_KEYS(KC_T, KC_M) {
|
||||
// ™
|
||||
send_unicode_hex_string("2122");
|
||||
}
|
||||
SEQ_THREE_KEYS(KC_G, KC_G, KC_T) {
|
||||
SEND_STRING("@GrahamGoldenTech.com");
|
||||
}
|
||||
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) {
|
||||
SEND_STRING("https://github.com/qmk/qmk_firmware/tree/master/users/arkag");
|
||||
}
|
||||
SEQ_FOUR_KEYS(KC_F, KC_L, KC_I, KC_P) {
|
||||
// (╯‵Д′)╯彡┻━┻
|
||||
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) {
|
||||
// ┬─┬ノ( º _ º ノ)
|
||||
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) {
|
||||
// ( ͡° ͜ʖ ͡°)
|
||||
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) {
|
||||
// ¯\_(ツ)_/¯
|
||||
send_unicode_hex_string("00AF 005C 005F 0028 30C4 0029 005F 002F 00AF");
|
||||
}
|
||||
// end typing functions
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||
|
@ -394,138 +499,12 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
|||
}
|
||||
return false;
|
||||
|
||||
case M_P_B:
|
||||
if (record->event.pressed) {
|
||||
if (current_os == OS_WIN) {
|
||||
SEND_STRING(SS_DOWN(X_LGUI) SS_TAP(X_PAUSE) SS_UP(X_LGUI));
|
||||
} else {
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
||||
case M_C_A_D:
|
||||
if (record->event.pressed) {
|
||||
if (current_os == OS_WIN) {
|
||||
SEND_STRING(SS_DOWN(X_LCTRL) SS_DOWN(X_LALT) SS_TAP(X_DELETE) SS_UP(X_LALT) SS_UP(X_LCTRL));
|
||||
} else {
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
||||
case M_CALC:
|
||||
if (record->event.pressed) {
|
||||
if (current_os == OS_WIN) {
|
||||
SEND_STRING(SS_TAP(X_CALCULATOR));
|
||||
} else if (current_os == OS_MAC) {
|
||||
SEND_STRING(SS_DOWN(X_LGUI) SS_TAP(X_SPACE) SS_UP(X_LGUI) "calculator" SS_TAP(X_ENTER));
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
||||
case M_OS:
|
||||
if (record->event.pressed) {
|
||||
set_os((current_os+1) % _OS_COUNT, true);
|
||||
}
|
||||
return false;
|
||||
|
||||
case M_LOD:
|
||||
if (record->event.pressed) {
|
||||
send_unicode_hex_string("0CA0 005F 005F 0CA0");
|
||||
}
|
||||
return false;
|
||||
|
||||
case M_LENNY:
|
||||
if (record->event.pressed) {
|
||||
send_unicode_hex_string("0028 0020 0361 00B0 0020 035C 0296 0020 0361 00B0 0029");
|
||||
}
|
||||
return false;
|
||||
|
||||
|
||||
case M_TF:
|
||||
if (record->event.pressed) {
|
||||
send_unicode_hex_string("0028 256F 2035 0414 2032 0029 256F 5F61 253B 2501 253B");
|
||||
}
|
||||
return false;
|
||||
|
||||
case M_UF:
|
||||
if (record->event.pressed) {
|
||||
send_unicode_hex_string("252C 2500 252C 30CE 0028 0020 00BA 0020 005F 0020 00BA 0020 30CE 0029");
|
||||
}
|
||||
return false;
|
||||
|
||||
case M_SHRUG:
|
||||
if (record->event.pressed) {
|
||||
send_unicode_hex_string("00AF 005C 005F 0028 30C4 0029 005F 002F 00AF");
|
||||
}
|
||||
return false;
|
||||
|
||||
case M_TM:
|
||||
if (record->event.pressed) {
|
||||
send_unicode_hex_string("2122");
|
||||
}
|
||||
return false;
|
||||
|
||||
case M_REPO:
|
||||
if (record->event.pressed) {
|
||||
SEND_STRING("https://github.com/qmk/qmk_firmware/tree/master/users/arkag");
|
||||
}
|
||||
return false;
|
||||
|
||||
case M_GGT:
|
||||
if (record->event.pressed) {
|
||||
SEND_STRING("@GrahamGoldenTech.com");
|
||||
}
|
||||
return false;
|
||||
|
||||
case M_SNIPT:
|
||||
if (record->event.pressed) {
|
||||
surround_type(6, KC_GRAVE, false);
|
||||
pri_mod(true);
|
||||
tap_key(KC_V);
|
||||
pri_mod(false);
|
||||
tap_key(KC_RGHT);
|
||||
tap_key(KC_RGHT);
|
||||
tap_key(KC_RGHT);
|
||||
tap_key(KC_ENTER);
|
||||
}
|
||||
return false;
|
||||
|
||||
case M_BOLD:
|
||||
if (record->event.pressed) {
|
||||
surround_type(4, KC_8, true);
|
||||
}
|
||||
return false;
|
||||
|
||||
case M_ITAL:
|
||||
if (record->event.pressed) {
|
||||
surround_type(2, KC_8, true);
|
||||
}
|
||||
return false;
|
||||
|
||||
case M_ULIN:
|
||||
if (record->event.pressed) {
|
||||
surround_type(4, KC_MINS, true);
|
||||
}
|
||||
return false;
|
||||
|
||||
case KC_LSFT:
|
||||
if (record->event.pressed) {
|
||||
save_color(underglow);
|
||||
underglow = mod_color(underglow, true, 75);
|
||||
SEND_STRING(SS_DOWN(X_LSHIFT));
|
||||
} else {
|
||||
reset_color();
|
||||
SEND_STRING(SS_UP(X_LSHIFT));
|
||||
}
|
||||
return false;
|
||||
|
||||
case MEDIA:
|
||||
case LAZY:
|
||||
case KEEB:
|
||||
case RAISE:
|
||||
case LOWER:
|
||||
return true;
|
||||
|
||||
default:
|
||||
if (record->event.pressed) {
|
||||
state = active;
|
||||
|
@ -535,36 +514,6 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
|||
}
|
||||
}
|
||||
|
||||
uint32_t layer_state_set_user(uint32_t state) {
|
||||
switch (biton32(state)) {
|
||||
case _LAZY:
|
||||
save_color(underglow);
|
||||
underglow = mod_color(underglow, true, 50);
|
||||
break;
|
||||
case _MEDIA:
|
||||
save_color(underglow);
|
||||
underglow = mod_color(underglow, true, 150);
|
||||
break;
|
||||
case _KEEB:
|
||||
save_color(underglow);
|
||||
underglow = mod_color(underglow, false, 150);
|
||||
break;
|
||||
case _LOWER:
|
||||
save_color(underglow);
|
||||
underglow = mod_color(underglow, false, 100);
|
||||
break;
|
||||
case _RAISE:
|
||||
save_color(underglow);
|
||||
underglow = mod_color(underglow, true, 100);
|
||||
break;
|
||||
default:
|
||||
reset_color();
|
||||
break;
|
||||
}
|
||||
set_color(underglow, false);
|
||||
return state;
|
||||
}
|
||||
|
||||
//Tap Dance Definitions
|
||||
qk_tap_dance_action_t tap_dance_actions[] = {
|
||||
[TD_3_GRV_ACT] = ACTION_TAP_DANCE_FN (dance_3),
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#pragma once
|
||||
|
||||
#define TAPPING_TERM 200
|
||||
#define TAPPING_TERM 200
|
||||
#define LEADER_TIMEOUT 250
|
||||
|
||||
#define IGNORE_MOD_TAP_INTERRUPT
|
||||
#define LEADER_PER_KEY_TIMING
|
||||
|
|
Loading…
Reference in a new issue