Skip to content

Commit b3d8365

Browse files
authored
Reorganize layout hierarchy
Reorganize for better layout abstraction & ZMK symmetry
1 parent acd761c commit b3d8365

35 files changed

Lines changed: 8780 additions & 25 deletions

users/moutis/config.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
// these COMBO_TERM have dilicate interactions with ADAPTIVE_TERM below.
5757
#define COMBO_TERM (TAPPING_TERM/4) // time to get all combo keys down
5858
#define COMBO_HOLD (TAPPING_TERM) // time to hold to trigger delayed combo
59-
#endif
59+
#endif // COMBO_ENABLE
6060

6161
#define EN_HDIGRAPH_COMBOS // English H-Digraph combos (Th,Ch,Wh,Sh,Gh,Ph,Sch)
6262
#define EN_PRONOUN_COMBOS // English First Person pronoun combos (I, I'm, I've I'd I'll etc) (184 bytes on AVR)

users/moutis/layouts/hd/adapt_h.c

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
/*
2+
* adapt_h.c
3+
* the common vowel block adaptives (esp. for "AU" SFB)
4+
*
5+
* included at the end of process_adaptive_key
6+
*/
7+
8+
9+
#ifdef ADAPT_H
10+
/*
11+
* H is a "Magic" adaptive key, depending on the preceding alphas
12+
*
13+
* Alternatively, the HD_MAGIC_A/HD_MAGIC_B may work better? They are
14+
* typically assigned to a thumb position (bspc/enter), so have no
15+
* conflict with other alphas. The use of the thumb may be less intuitive
16+
* and thus require more training. BSPC/ENTER are used because they tend
17+
* to have a brief pause before, so they may co-exist well.
18+
*/
19+
case KC_H: // H precedes a vowel much more often than it follows (thanks, Ancient Greek!) so adaptive H is a sort of Magic Key
20+
switch (prior_keycode) { // maybe OK? What about xxR? resulting in a SFB on thumb?
21+
#if !defined(ADAPT_AE_AU) && !defined(DE_ADAPTIVES) // AU is really common it German (and influences EN/FR)
22+
/* This one doesn't work bc AH is more common than AE…so use "A'" instead
23+
case KC_A: // AE is a fraction less common (8x), but the EAE trill may be harder than EAH.
24+
tap_code(KC_U); // "AH" yields "AU" (7x more common)
25+
return_state = false; // done.
26+
break;
27+
*/
28+
#endif // ADAPT_AE_AU or !DE_ADAPTIVES
29+
case KC_U: //
30+
tap_code(KC_A); // "UH" yields "UA" (126x more common)
31+
return_state = false; // done.
32+
break;
33+
case KC_E: // these EO/OE adaptives are of questionable value
34+
tap_code(KC_O); // "EH" yields "EO" (1.75:1)
35+
return_state = false; // done.
36+
break;
37+
case KC_O:
38+
tap_code(KC_E); // "OH" yields "OE" (almost 1:1, but eliminates an SFB?)
39+
return_state = false; // done.
40+
break;
41+
case KC_Y:
42+
tap_code(KC_I); // "YH" basically never occurs, so turn this SFB into a step
43+
return_state = false; // done.
44+
break;
45+
#if HD_LAYOUT == vfj
46+
case KC_V:
47+
tap_code(KC_L); // "VH" yields "VL" turning an awkward step into an alt
48+
return_state = false; // done.
49+
break;
50+
#endif // HD_LAYOUT == vfj
51+
#ifndef FR_ADAPTIVES
52+
// these are possible, but rather uncommon
53+
case KC_L: // LH->LN (4.43 202207313)
54+
case KC_M: // MH->MN (15.49 232816441)
55+
tap_code(KC_N); //
56+
return_state = false; // done.
57+
break;
58+
case KC_N: // NH->NL (4.86 1491607169)
59+
tap_code(KC_L);
60+
return_state = false; // done.
61+
break;
62+
#else // FR_ADAPTIVES // eliminate 'h SFB for French
63+
case KC_D: // ex. d'habitude
64+
case KC_J: // ex. j'habite
65+
case KC_L: // ex. l'hôtel
66+
case KC_N: // ex. n'habite
67+
#ifdef EN_HDIGRAPH_COMBOS
68+
case KC_T: // t'habitude can't do this (bc Th) unless Th digraph combo is used…
69+
#endif // EN_HDIGRAPH_COMBOS
70+
tap_code(KC_QUOT); // YH => Y' (pull down to reduce ring-pinky T-B scissor)
71+
break;
72+
#endif // FR_ADAPTIVES
73+
}
74+
break;
75+
#endif // ADAPT_H
76+
77+
#if defined(ADAPT_AE_AU) || defined(DE_ADAPTIVES) // AU is really common in German (and influences EN/FR)
78+
case KC_E:
79+
switch (prior_keycode) {
80+
case KC_A: // "AE" yields "AU" (8x more common) keeping it on home row
81+
tap_code(KC_U);
82+
return_state = false; // done.
83+
}
84+
break;
85+
#endif // ADAPT_AE_AU
Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
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

Comments
 (0)