|
| 1 | +/* |
| 2 | + Adaptive Keys |
| 3 | + Called from early within process_record_user |
| 4 | +
|
| 5 | + Tailored for HD Gold (au) |
| 6 | + |
| 7 | + NOTE: assumed dual-function keys (MOD_TAP, LAYER_TAP) have already been handled AND |
| 8 | + FILTERED OUT! The combos handler will have already taken out combo candidates, |
| 9 | + which have a shorter keydown threshhold (COMBO_TERM). |
| 10 | + |
| 11 | + */ |
| 12 | +// Base (alpha) Layer Hands Down Gold (HRMs /+ thumb mods) |
| 13 | +// ╭─────────────────────╮ ╭─────────────────────╮ |
| 14 | +// esc │ J G M P V │ L_CFG L_NUM │ #$ .: /* "[ '] │ LANG2/henk |
| 15 | +// tab │ R S N D B | ( ) | ,; A E I H │ LANG1/mhen |
| 16 | +// Z │ X F L C W │ [ copy pste ] │ -+ U O Y K │ Q |
| 17 | +// ╰───────────╮ bsp T │ & | │ spc ret ╭──────────╯ |
| 18 | +// left rght app ╰─────────╯ ╰──────────╯ tgLN up dn |
| 19 | + |
| 20 | +// For small boards, Q (LT3) & Z (LT4) are (also) on the sym layer |
| 21 | + |
| 22 | + |
| 23 | +bool process_adaptive_key(uint16_t keycode, const keyrecord_t *record) { |
| 24 | + bool return_state = true; // assume we don't do anything. |
| 25 | + |
| 26 | + // Are we in an adaptive context? (adaptive on is assumed). |
| 27 | + if (timer_elapsed(prior_keydown) > ADAPTIVE_TERM) { // outside adaptive threshhold |
| 28 | + prior_keycode = preprior_keycode = prior_keydown = 0; // turn off Adaptives. |
| 29 | + return true; // no adaptive conditions, so return. |
| 30 | + } |
| 31 | + |
| 32 | + // K, this could be adaptive, so process. |
| 33 | + saved_mods = get_mods(); |
| 34 | + |
| 35 | + if (!caps_word_timer) { // turn off shift, (first-words & Proper nouns) |
| 36 | + unregister_mods(MOD_MASK_SHIFT); //CAPS_WORD/LOCK won't be affected. |
| 37 | + } // may want more granular control than this… |
| 38 | + |
| 39 | +// switch (((keycode >= SAFE_RANGE) && (keycode <= SemKeys_COUNT)) ? (keycode) : (keycode & QK_BASIC_MAX)) { // only handling normal, SHFT or ALT cases. |
| 40 | + |
| 41 | + switch (keycode) { // process ignoring multi-function keys & shift state? |
| 42 | + |
| 43 | +/* |
| 44 | +// Left hand adaptives (most are single-handed neighbor fingers, bc speed, dexterity limits) |
| 45 | +*/ |
| 46 | + case KC_B: // avoid the index-middle split |
| 47 | + switch (prior_keycode) { |
| 48 | + case KC_P: // pull up M over |
| 49 | + tap_code(KC_BSPC); |
| 50 | + tap_code(KC_M); |
| 51 | + break; |
| 52 | + case KC_D: // pull L over |
| 53 | + tap_code(KC_L); // pull up "L" |
| 54 | + return_state = false; // done. |
| 55 | + break; |
| 56 | + } |
| 57 | + break; |
| 58 | + case KC_D: // |
| 59 | + switch (prior_keycode) { // |
| 60 | + case KC_B: |
| 61 | + tap_code(KC_L); // pull up "L" |
| 62 | + return_state = false; // done. |
| 63 | + break; |
| 64 | + } |
| 65 | + break; |
| 66 | + |
| 67 | + case KC_M: // M becomes L (pull up "L" to same row) |
| 68 | + switch (prior_keycode) { |
| 69 | + case KC_P: // pull up "L" (PL is 15x more common than PM) |
| 70 | + case KC_G: // pull up "L" (GL is 5x more common than GM) |
| 71 | + tap_code(KC_L); // pull up "L" |
| 72 | + return_state = false; // done. |
| 73 | + break; |
| 74 | + case KC_J: // |
| 75 | + tap_code(KC_BSPC); |
| 76 | + tap_code(KC_L); |
| 77 | + break; |
| 78 | + } |
| 79 | + break; |
| 80 | + case KC_P: |
| 81 | + switch (prior_keycode) { |
| 82 | + case KC_G: // avoid the LP scissor |
| 83 | + tap_code(KC_BSPC); |
| 84 | + tap_code(KC_L); |
| 85 | + break; |
| 86 | + case KC_J: |
| 87 | + tap_code(KC_BSPC); |
| 88 | + send_string("lml"); // for "calmly" but not quite intuitive… |
| 89 | + return_state = false; // done. |
| 90 | + break; |
| 91 | + case KC_V: // avoid the index-middle split |
| 92 | + tap_code(KC_L); // pull up "L" |
| 93 | + return_state = false; // done. |
| 94 | + break; |
| 95 | + } |
| 96 | + break; |
| 97 | + case KC_X: // |
| 98 | + switch (prior_keycode) { // |
| 99 | + case KC_C: // CD is 70x more common than CX |
| 100 | + tap_code(KC_D); // eliminate the SFB |
| 101 | + return_state = false; // done. |
| 102 | + break; |
| 103 | + } |
| 104 | + break; |
| 105 | + |
| 106 | + |
| 107 | + |
| 108 | +/* |
| 109 | +// right hand adaptives |
| 110 | +*/ |
| 111 | + case KC_K: |
| 112 | + switch (prior_keycode) { |
| 113 | + case KC_Y: // eliminate SFB on ring finger |
| 114 | + tap_code(KC_I); |
| 115 | + return_state = false; // done. |
| 116 | + break; |
| 117 | + } |
| 118 | + break; |
| 119 | + |
| 120 | +#include "adapt_h.c" // the common vowel block adaptives (esp. for AU SFB) |
| 121 | + |
| 122 | +#if defined (HD_MAGIC) || defined (HD_MAGIC_A) || defined (HD_MAGIC_B) |
| 123 | +#include "adapt_magic.c" // the common adaptive "magic" key |
| 124 | +#endif // |
| 125 | + |
| 126 | + } |
| 127 | + if (return_state) { // no adaptive processed, cancel state and pass it on. |
| 128 | + set_mods(saved_mods); |
| 129 | + prior_keycode = preprior_keycode = keycode = 0; |
| 130 | + } |
| 131 | + return return_state; // |
| 132 | +} |
0 commit comments