diff options
author | Alexander Kagno <cwre@protonmail.com> | 2018-09-29 18:51:06 -0600 |
---|---|---|
committer | Drashna Jaelre <drashna@live.com> | 2018-09-29 17:51:06 -0700 |
commit | 3875d6f5815bf263cb3ee5d18b74c5ec8ab865f2 (patch) | |
tree | c5d1be0a02fa3374faeafd362f930bb1f48740f6 /users/arkag | |
parent | 170507896d4d7fe12e1fa2c31ab8589e4cbdf7ba (diff) | |
download | qmk_firmware-3875d6f5815bf263cb3ee5d18b74c5ec8ab865f2.tar.gz qmk_firmware-3875d6f5815bf263cb3ee5d18b74c5ec8ab865f2.zip |
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
Diffstat (limited to 'users/arkag')
-rw-r--r-- | users/arkag/arkag.c | 213 | ||||
-rw-r--r-- | users/arkag/config.h | 5 |
2 files changed, 84 insertions, 134 deletions
diff --git a/users/arkag/arkag.c b/users/arkag/arkag.c index a35e13ed6b..212d06de67 100644 --- a/users/arkag/arkag.c +++ b/users/arkag/arkag.c @@ -370,115 +370,70 @@ void matrix_init_user(void) { set_os(current_os, false); } +LEADER_EXTERNS(); + void matrix_scan_user(void) { check_state(); flash_rgb(); fade_rgb(); -} - -bool process_record_user(uint16_t keycode, keyrecord_t *record) { - switch (keycode) { - case M_PMOD: - if (record->event.pressed) { - pri_mod(true); - } else { - pri_mod(false); - } - return false; + LEADER_DICTIONARY() { + leading = false; + leader_end(); - case M_SMOD: - if (record->event.pressed) { - sec_mod(true); - } else { - sec_mod(false); - } - return false; - - case M_P_B: - if (record->event.pressed) { + // 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 { } } - return false; - - case M_C_A_D: - if (record->event.pressed) { + 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 { } } - return false; - - case M_CALC: - if (record->event.pressed) { + 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)); } } - 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; + // end OS functions - case M_LENNY: - if (record->event.pressed) { - send_unicode_hex_string("0028 0020 0361 00B0 0020 035C 0296 0020 0361 00B0 0029"); + // begin format functions + SEQ_ONE_KEY(KC_B) { + surround_type(4, KC_8, true); } - return false; - - - case M_TF: - if (record->event.pressed) { - send_unicode_hex_string("0028 256F 2035 0414 2032 0029 256F 5F61 253B 2501 253B"); + SEQ_ONE_KEY(KC_I) { + surround_type(2, KC_8, true); } - 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"); + SEQ_ONE_KEY(KC_U) { + surround_type(4, KC_MINS, true); } - return false; - - case M_SHRUG: - if (record->event.pressed) { - send_unicode_hex_string("00AF 005C 005F 0028 30C4 0029 005F 002F 00AF"); + SEQ_ONE_KEY(KC_S) { + surround_type(4, KC_GRAVE, true); } - return false; - - case M_TM: - if (record->event.pressed) { - send_unicode_hex_string("2122"); + 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; + } } - return false; - - case M_REPO: - if (record->event.pressed) { - SEND_STRING("https://github.com/qmk/qmk_firmware/tree/master/users/arkag"); + SEQ_ONE_KEY(KC_C) { + surround_type(2, KC_GRAVE, false); } - return false; - - case M_GGT: - if (record->event.pressed) { - SEND_STRING("@GrahamGoldenTech.com"); + SEQ_TWO_KEYS(KC_C, KC_C) { + surround_type(6, KC_GRAVE, false); } - return false; + // end format functions - case M_SNIPT: - if (record->event.pressed) { + // 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); @@ -488,44 +443,68 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { tap_key(KC_RGHT); tap_key(KC_ENTER); } - return false; + // end fancy functions - case M_BOLD: - if (record->event.pressed) { - surround_type(4, KC_8, true); + // start typing functions + SEQ_TWO_KEYS(KC_T, KC_M) { + // ™ + send_unicode_hex_string("2122"); } - return false; + 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 - case M_ITAL: + } +} + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case M_PMOD: if (record->event.pressed) { - surround_type(2, KC_8, true); + pri_mod(true); + } else { + pri_mod(false); } return false; - case M_ULIN: + case M_SMOD: if (record->event.pressed) { - surround_type(4, KC_MINS, true); + sec_mod(true); + } else { + sec_mod(false); } return false; - case KC_LSFT: + case M_OS: 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)); + set_os((current_os+1) % _OS_COUNT, true); } 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), diff --git a/users/arkag/config.h b/users/arkag/config.h index e715e5534e..2e0a9ad019 100644 --- a/users/arkag/config.h +++ b/users/arkag/config.h @@ -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 |