mirror of
https://github.com/qmk/qmk_userspace.git
synced 2025-11-07 12:09:58 -05:00
MAJ 2e Kyria
This commit is contained in:
parent
7838a7c4cd
commit
d0869cd7e6
9 changed files with 117 additions and 98 deletions
|
|
@ -19,11 +19,11 @@
|
||||||
#include "clever_keys.h"
|
#include "clever_keys.h"
|
||||||
|
|
||||||
|
|
||||||
bool clever_key_finder(uint16_t next_keycode, keyrecord_t* record) {
|
void get_clever_keycode(uint16_t* next_keycode, keyrecord_t* record) {
|
||||||
|
|
||||||
uint16_t prev_keycode = recent[RECENT_SIZE - 1];
|
uint16_t prev_keycode = recent[RECENT_SIZE - 1];
|
||||||
|
|
||||||
if (isLetter(next_keycode) || isSendStringMacro(next_keycode)) {
|
if (isLetter(*next_keycode) || isSendStringMacro(*next_keycode)) {
|
||||||
switch (prev_keycode) {
|
switch (prev_keycode) {
|
||||||
case FG_EXLM:
|
case FG_EXLM:
|
||||||
case FG_QUES:
|
case FG_QUES:
|
||||||
|
|
@ -31,7 +31,7 @@ bool clever_key_finder(uint16_t next_keycode, keyrecord_t* record) {
|
||||||
case FG_2PTS:
|
case FG_2PTS:
|
||||||
// Add space between punctuation and letters.
|
// Add space between punctuation and letters.
|
||||||
invoke_key(KC_SPC, record);
|
invoke_key(KC_SPC, record);
|
||||||
set_last_keycode(next_keycode);
|
set_last_keycode(*next_keycode);
|
||||||
|
|
||||||
case KC_SPC:
|
case KC_SPC:
|
||||||
switch (recent[RECENT_SIZE - 2]) {
|
switch (recent[RECENT_SIZE - 2]) {
|
||||||
|
|
@ -49,14 +49,8 @@ bool clever_key_finder(uint16_t next_keycode, keyrecord_t* record) {
|
||||||
|
|
||||||
switch (prev_keycode) {
|
switch (prev_keycode) {
|
||||||
|
|
||||||
/* case FG_C:
|
|
||||||
if (next_keycode == FG_A) {
|
|
||||||
invoke_key(FG_U,record);
|
|
||||||
break;
|
|
||||||
} */
|
|
||||||
|
|
||||||
case FG_Q:
|
case FG_Q:
|
||||||
switch (next_keycode) {
|
switch (*next_keycode) {
|
||||||
|
|
||||||
// Ajout automatique du "u" après le "q"
|
// Ajout automatique du "u" après le "q"
|
||||||
case FG_E:
|
case FG_E:
|
||||||
|
|
@ -66,54 +60,57 @@ bool clever_key_finder(uint16_t next_keycode, keyrecord_t* record) {
|
||||||
case FG_EACU:
|
case FG_EACU:
|
||||||
case FG_APOS:
|
case FG_APOS:
|
||||||
invoke_key(FG_U, record);
|
invoke_key(FG_U, record);
|
||||||
|
set_last_keycode(*next_keycode);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// Raccourci pour "quelq"
|
// Raccourci pour "quelq"
|
||||||
case FG_Q:
|
case FG_Q:
|
||||||
clear_recent_keys(); // To prevent infinite loop
|
|
||||||
process_word((uint16_t[]) {FG_U, FG_E, FG_L}, 3, record);
|
process_word((uint16_t[]) {FG_U, FG_E, FG_L}, 3, record);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// Raccourci pour "quoi", ça évite un aller-retour sur la main gauche.
|
// Raccourci pour "quoi", ça évite un aller-retour sur la main gauche.
|
||||||
case FG_Z:
|
case FG_Z:
|
||||||
return finish_word((uint16_t[]) {FG_U, FG_O, FG_I}, 3, record);
|
finish_word((uint16_t[]) {FG_U, FG_O, FG_I}, 3, next_keycode, record);
|
||||||
|
break;
|
||||||
|
|
||||||
// Raccourci pour "quand"
|
// Raccourci pour "quand"
|
||||||
case FG_D:
|
case FG_D:
|
||||||
process_word((uint16_t[]) {FG_U, FG_A, FG_N}, 3, record);
|
process_word((uint16_t[]) {FG_U, FG_A, FG_N}, 3, record);
|
||||||
|
set_last_keycode(*next_keycode);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case FG_P:
|
case FG_P:
|
||||||
switch (next_keycode) {
|
switch (*next_keycode) {
|
||||||
|
|
||||||
case FG_M:
|
case FG_M:
|
||||||
// "pas"
|
// "pas"
|
||||||
return finish_word((uint16_t[]) {FG_A, FG_S}, 2, record);
|
return finish_word((uint16_t[]) {FG_A, FG_S}, 2, next_keycode, record);
|
||||||
|
|
||||||
case FG_APOS:
|
case FG_APOS:
|
||||||
// "par"
|
// "par"
|
||||||
return finish_word((uint16_t[]) {FG_A, FG_R}, 2, record);
|
return finish_word((uint16_t[]) {FG_A, FG_R}, 2, next_keycode, record);
|
||||||
|
|
||||||
case FG_POIN:
|
case FG_POIN:
|
||||||
if (!isLetter(recent[RECENT_SIZE - 2])) {
|
if (!isLetter(recent[RECENT_SIZE - 2])) {
|
||||||
// "pour"
|
// "pour"
|
||||||
return finish_word((uint16_t[]) {FG_O, FG_U, FG_R}, 3, record);
|
return finish_word((uint16_t[]) {FG_O, FG_U, FG_R}, 3, next_keycode, record);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case FG_CCED:
|
/* case FG_CCED:
|
||||||
if (!isLetter(next_keycode)) {
|
if (!isLetter(*next_keycode)) {
|
||||||
invoke_key(FG_A, record);
|
invoke_key(FG_A, record);
|
||||||
|
set_last_keycode(*next_keycode);
|
||||||
}
|
}
|
||||||
break;
|
break; */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
switch (next_keycode) {
|
switch (*next_keycode) {
|
||||||
|
|
||||||
case FG_QUES:
|
case FG_QUES:
|
||||||
case FG_EXLM:
|
case FG_EXLM:
|
||||||
|
|
@ -121,7 +118,7 @@ bool clever_key_finder(uint16_t next_keycode, keyrecord_t* record) {
|
||||||
// Il ne faut pas tester cette fonctionnalité avec Word, qui ajoute cet espace automatiquement.
|
// Il ne faut pas tester cette fonctionnalité avec Word, qui ajoute cet espace automatiquement.
|
||||||
if (isLetter(recent[RECENT_SIZE - 1])) {
|
if (isLetter(recent[RECENT_SIZE - 1])) {
|
||||||
invoke_key(KC_SPC, record);
|
invoke_key(KC_SPC, record);
|
||||||
return replace_next_key(next_keycode, record);
|
return replace_ongoing_key(*next_keycode, next_keycode, record);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
@ -131,49 +128,49 @@ bool clever_key_finder(uint16_t next_keycode, keyrecord_t* record) {
|
||||||
case FG_T:
|
case FG_T:
|
||||||
invoke_key(FG_I, record);
|
invoke_key(FG_I, record);
|
||||||
case FG_I:
|
case FG_I:
|
||||||
return finish_magic((uint16_t[]) {FG_O, FG_N}, 2, record);
|
return finish_word((uint16_t[]) {FG_O, FG_N}, 2, next_keycode, record);
|
||||||
|
|
||||||
case FG_C:
|
case FG_C:
|
||||||
return finish_magic((uint16_t[]) {FG_APOS, FG_E, FG_S, FG_T}, 4, record);
|
return finish_word((uint16_t[]) {FG_APOS, FG_E, FG_S, FG_T}, 4, next_keycode, record);
|
||||||
|
|
||||||
case FG_D:
|
case FG_D:
|
||||||
return finish_magic((uint16_t[]) {FG_A, FG_N, FG_S}, 3, record);
|
return finish_word((uint16_t[]) {FG_A, FG_N, FG_S}, 3, next_keycode, record);
|
||||||
|
|
||||||
case FG_P:
|
case FG_P:
|
||||||
return finish_magic((uint16_t[]) {FG_L, FG_U, FG_S}, 3, record);
|
return finish_word((uint16_t[]) {FG_L, FG_U, FG_S}, 3, next_keycode, record);
|
||||||
|
|
||||||
case FG_O:
|
case FG_O:
|
||||||
return finish_magic((uint16_t[]) {FG_N, FG_T}, 2, record);
|
return finish_word((uint16_t[]) {FG_N, FG_T}, 2, next_keycode, record);
|
||||||
|
|
||||||
case FG_A:
|
case FG_A:
|
||||||
if (isLetter(recent[RECENT_SIZE - 2])) {
|
if (isLetter(recent[RECENT_SIZE - 2])) {
|
||||||
// "ant"
|
// "ant"
|
||||||
return finish_magic((uint16_t[]) {FG_N, FG_T}, 2, record);
|
return finish_word((uint16_t[]) {FG_N, FG_T}, 2, next_keycode, record);
|
||||||
} else {
|
} else {
|
||||||
// "avec"
|
// "avec"
|
||||||
return finish_magic((uint16_t[]) {FG_V, FG_E, FG_C}, 3, record);
|
return finish_word((uint16_t[]) {FG_V, FG_E, FG_C}, 3, next_keycode, record);
|
||||||
}
|
}
|
||||||
|
|
||||||
case FG_S:
|
case FG_S:
|
||||||
return finish_magic((uint16_t[]) {FG_U, FG_R}, 2, record);
|
return finish_word((uint16_t[]) {FG_U, FG_R}, 2, next_keycode, record);
|
||||||
|
|
||||||
case FG_B:
|
case FG_B:
|
||||||
process_word((uint16_t[]) {FG_O, FG_N, FG_J}, 3, record);
|
process_word((uint16_t[]) {FG_O, FG_N, FG_J}, 3, record);
|
||||||
|
|
||||||
case FG_J:
|
case FG_J:
|
||||||
return finish_magic((uint16_t[]) {FG_O, FG_U, FG_R}, 3, record);
|
return finish_word((uint16_t[]) {FG_O, FG_U, FG_R}, 3, next_keycode, record);
|
||||||
|
|
||||||
case FG_M:
|
case FG_M:
|
||||||
if (isLetter(recent[RECENT_SIZE - 2])) {
|
if (isLetter(recent[RECENT_SIZE - 2])) {
|
||||||
// "ment"
|
// "ment"
|
||||||
return finish_magic((uint16_t[]) {FG_E, FG_N, FG_T}, 3, record);
|
return finish_word((uint16_t[]) {FG_E, FG_N, FG_T}, 3, next_keycode, record);
|
||||||
} else {
|
} else {
|
||||||
// "même"
|
// "même"
|
||||||
return finish_magic((uint16_t[]) {FG_ODK, FG_O, FG_M, FG_E}, 4, record);
|
return finish_word((uint16_t[]) {FG_ODK, FG_O, FG_M, FG_E}, 4, next_keycode, record);
|
||||||
}
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return false;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
case FG_AROB:
|
case FG_AROB:
|
||||||
|
|
@ -183,32 +180,32 @@ bool clever_key_finder(uint16_t next_keycode, keyrecord_t* record) {
|
||||||
case FG_T:
|
case FG_T:
|
||||||
// "t@" -> "toujours"
|
// "t@" -> "toujours"
|
||||||
layer_off(_ODK);
|
layer_off(_ODK);
|
||||||
return finish_word((uint16_t[]) {FG_O, FG_U, FG_J, FG_O, FG_U, FG_R, FG_S}, 7, record);
|
return finish_word((uint16_t[]) {FG_O, FG_U, FG_J, FG_O, FG_U, FG_R, FG_S}, 7, next_keycode, record);
|
||||||
|
|
||||||
case FG_P:
|
case FG_P:
|
||||||
// "p@" -> "peut-être"
|
// "p@" -> "peut-être"
|
||||||
layer_off(_ODK);
|
layer_off(_ODK);
|
||||||
return finish_word((uint16_t[]) {FG_E, FG_U, FG_T, FG_MOIN, FG_ODK, FG_O, FG_T, FG_R, FG_E}, 9, record);
|
return finish_word((uint16_t[]) {FG_E, FG_U, FG_T, FG_MOIN, FG_ODK, FG_O, FG_T, FG_R, FG_E}, 9, next_keycode, record);
|
||||||
|
|
||||||
case FG_A:
|
case FG_A:
|
||||||
// "a@" -> "aujourd'hui"
|
// "a@" -> "aujourd'hui"
|
||||||
layer_off(_ODK);
|
layer_off(_ODK);
|
||||||
return finish_word((uint16_t[]) {FG_U, FG_J, FG_O, FG_U, FG_R, FG_D, FG_APOS, FG_H, FG_U, FG_I}, 10, record);
|
return finish_word((uint16_t[]) {FG_U, FG_J, FG_O, FG_U, FG_R, FG_D, FG_APOS, FG_H, FG_U, FG_I}, 10, next_keycode, record);
|
||||||
|
|
||||||
case FG_B:
|
case FG_B:
|
||||||
// "b@" -> "beaucoup"
|
// "b@" -> "beaucoup"
|
||||||
layer_off(_ODK);
|
layer_off(_ODK);
|
||||||
return finish_word((uint16_t[]) {FG_E, FG_A, FG_U, FG_C, FG_O, FG_U, FG_P}, 7, record);
|
return finish_word((uint16_t[]) {FG_E, FG_A, FG_U, FG_C, FG_O, FG_U, FG_P}, 7, next_keycode, record);
|
||||||
|
|
||||||
case FG_E:
|
case FG_E:
|
||||||
// "e@" -> "est-ce qu"
|
// "e@" -> "est-ce qu"
|
||||||
layer_off(_ODK);
|
layer_off(_ODK);
|
||||||
return finish_word((uint16_t[]) {FG_S, FG_T, FG_MOIN, FG_C, FG_E, KC_SPC, FG_Q}, 7, record);
|
return finish_word((uint16_t[]) {FG_S, FG_T, FG_MOIN, FG_C, FG_E, KC_SPC, FG_Q}, 7, next_keycode, record);
|
||||||
|
|
||||||
case FG_D:
|
case FG_D:
|
||||||
// "d@" -> "déjà"
|
// "d@" -> "déjà"
|
||||||
layer_off(_ODK);
|
layer_off(_ODK);
|
||||||
return finish_word((uint16_t[]) {FG_EACU, FG_J, FG_ODK, FG_A}, 4, record);
|
return finish_word((uint16_t[]) {FG_EACU, FG_J, FG_ODK, FG_A}, 4, next_keycode, record);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
@ -217,6 +214,8 @@ bool clever_key_finder(uint16_t next_keycode, keyrecord_t* record) {
|
||||||
if (prev_keycode == FG_J) {
|
if (prev_keycode == FG_J) {
|
||||||
// "jq" -> "jusqu"
|
// "jq" -> "jusqu"
|
||||||
process_word((uint16_t[]) {FG_U, FG_S}, 2, record);
|
process_word((uint16_t[]) {FG_U, FG_S}, 2, record);
|
||||||
|
set_last_keycode(*next_keycode);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
@ -224,8 +223,7 @@ bool clever_key_finder(uint16_t next_keycode, keyrecord_t* record) {
|
||||||
//if (prev_keycode == FG_O && !isCaps) {
|
//if (prev_keycode == FG_O && !isCaps) {
|
||||||
if (prev_keycode == FG_O) {
|
if (prev_keycode == FG_O) {
|
||||||
// "oa" -> "oi"
|
// "oa" -> "oi"
|
||||||
clear_recent_keys(); // To prevent infinite loop
|
return replace_ongoing_key(FG_I, next_keycode, record);
|
||||||
return replace_next_key(FG_I, record);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
@ -233,26 +231,29 @@ bool clever_key_finder(uint16_t next_keycode, keyrecord_t* record) {
|
||||||
//if (prev_keycode == FG_O && !isCaps && recent[RECENT_SIZE - 3] != FG_Q) {
|
//if (prev_keycode == FG_O && !isCaps && recent[RECENT_SIZE - 3] != FG_Q) {
|
||||||
if (prev_keycode == FG_O && recent[RECENT_SIZE - 3] != FG_Q) {
|
if (prev_keycode == FG_O && recent[RECENT_SIZE - 3] != FG_Q) {
|
||||||
// "oi" -> "oa", for "keyboard"
|
// "oi" -> "oa", for "keyboard"
|
||||||
clear_recent_keys(); // To prevent infinite loop
|
return replace_ongoing_key(FG_A, next_keycode, record);
|
||||||
return replace_next_key(FG_A, record);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case FG_O:
|
case FG_O:
|
||||||
if (prev_keycode == FG_U && recent[RECENT_SIZE - 2] != FG_Q) {
|
if (prev_keycode == FG_U && recent[RECENT_SIZE - 2] != FG_Q) {
|
||||||
// "uo" -> "un"
|
// "uo" -> "un"
|
||||||
return replace_next_key(FG_N, record);
|
return replace_ongoing_key(FG_N, next_keycode, record);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case OU_GRV:
|
case OU_GRV:
|
||||||
layer_off(_ODK);
|
layer_off(_ODK);
|
||||||
return finish_word((uint16_t[]) {FG_O, FG_ODK, FG_T}, 3, record);
|
return finish_word((uint16_t[]) {FG_O, FG_ODK, FG_T}, 3, next_keycode, record);
|
||||||
|
|
||||||
case AGRV_SPC:
|
/* case CA_CED:
|
||||||
layer_off(_ODK);
|
layer_off(_ODK);
|
||||||
return finish_word((uint16_t[]) {FG_AGR, KC_SPC}, 2, record);
|
return finish_word((uint16_t[]) {FG_CCED, FG_A}, 2, next_keycode, record); */
|
||||||
|
|
||||||
|
/* case AGRV_SPC:
|
||||||
|
layer_off(_ODK);
|
||||||
|
return finish_word((uint16_t[]) {FG_AGR, KC_SPC}, 2, next_keycode, record); */
|
||||||
}
|
}
|
||||||
|
|
||||||
return false; // Process next keycode normally
|
//return KC_NO; // Process next keycode normally
|
||||||
}
|
}
|
||||||
|
|
@ -25,7 +25,7 @@
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
bool clever_key_finder(uint16_t next_keycode, keyrecord_t* record);
|
void get_clever_keycode(uint16_t* next_keycode, keyrecord_t* record);
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
|
||||||
|
|
@ -18,10 +18,12 @@
|
||||||
|
|
||||||
uint16_t recent[RECENT_SIZE] = {KC_NO};
|
uint16_t recent[RECENT_SIZE] = {KC_NO};
|
||||||
uint16_t deadline = 0;
|
uint16_t deadline = 0;
|
||||||
|
//static unsigned short int bkspc_countdown = RECENT_SIZE + 1;
|
||||||
unsigned short int bkspc_countdown = RECENT_SIZE + 1;
|
unsigned short int bkspc_countdown = RECENT_SIZE + 1;
|
||||||
|
|
||||||
// Copy of the record argument for the clever key.
|
// Copy of the record argument for the clever key.
|
||||||
static keyrecord_t mod_record;
|
static keyrecord_t mod_record;
|
||||||
|
static bool processingCK = false;
|
||||||
|
|
||||||
void clear_recent_keys(void) {
|
void clear_recent_keys(void) {
|
||||||
memset(recent, 0, sizeof(recent)); // Set all zeros (KC_NO).
|
memset(recent, 0, sizeof(recent)); // Set all zeros (KC_NO).
|
||||||
|
|
@ -35,8 +37,7 @@ void recent_keys_task(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handles one event. Returns false if the key was appended to `recent`.
|
// Handles one event. Returns false if the key was appended to `recent`.
|
||||||
uint16_t get_next_keycode(uint16_t keycode, keyrecord_t* record) {
|
uint16_t get_ongoing_keycode(uint16_t keycode, keyrecord_t* record) {
|
||||||
if (!record->event.pressed) { return KC_NO; }
|
|
||||||
|
|
||||||
uint8_t mods = get_mods() | get_oneshot_mods();
|
uint8_t mods = get_mods() | get_oneshot_mods();
|
||||||
|
|
||||||
|
|
@ -150,37 +151,45 @@ void invoke_key(uint16_t keycode, keyrecord_t* record) {
|
||||||
bkspc_countdown = 1;
|
bkspc_countdown = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool replace_next_key(uint16_t keycode, keyrecord_t* record) {
|
void replace_ongoing_key(uint16_t clever_keycode, uint16_t* ongoing_keycode, keyrecord_t* record) {
|
||||||
invoke_key(keycode, record);
|
record->keycode = clever_keycode;
|
||||||
return true;
|
*ongoing_keycode = clever_keycode;
|
||||||
|
set_last_keycode(clever_keycode);
|
||||||
|
processingCK = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void process_word(uint16_t keycodes[], uint8_t num_keycodes, keyrecord_t* record) {
|
void process_word(uint16_t keycodes[], uint8_t num_keycodes, keyrecord_t* record) {
|
||||||
for (int i = 0; i < num_keycodes; ++i) {
|
for (int i = 0; i < num_keycodes; ++i) {
|
||||||
invoke_key(keycodes[i], record);
|
process_key(keycodes[i], record); // Better solution, if there is enought space in the chip.
|
||||||
|
//tap_code(keycodes[i]);
|
||||||
}
|
}
|
||||||
bkspc_countdown = num_keycodes;
|
bkspc_countdown = num_keycodes;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool finish_word(uint16_t keycodes[], uint8_t num_keycodes, keyrecord_t* record) {
|
void finish_word(uint16_t keycodes[], uint8_t num_keycodes, uint16_t* ongoing_keycode, keyrecord_t* record) {
|
||||||
process_word(keycodes, num_keycodes, record);
|
process_word(keycodes, num_keycodes - 1, record);
|
||||||
return true;
|
replace_ongoing_key(keycodes[num_keycodes - 1], ongoing_keycode, record);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool finish_magic(uint16_t keycodes[], uint8_t num_keycodes, keyrecord_t* record) {
|
|
||||||
// Set the keycode to be repeated to match the key buffer.
|
|
||||||
set_last_keycode(keycodes[num_keycodes - 1]);
|
|
||||||
return finish_word(keycodes, num_keycodes, record);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool process_clever_keys(uint16_t keycode, keyrecord_t* record) {
|
bool process_clever_keys(uint16_t keycode, keyrecord_t* record) {
|
||||||
|
|
||||||
uint16_t next_keycode = get_next_keycode(keycode, record);
|
if (record->event.pressed) {
|
||||||
|
uint16_t ongoing_keycode = get_ongoing_keycode(keycode, record);
|
||||||
|
|
||||||
if (next_keycode != KC_NO) {
|
if (ongoing_keycode != KC_NO) {
|
||||||
|
get_clever_keycode(&ongoing_keycode, record);
|
||||||
if (clever_key_finder(next_keycode, record)) { return false; }
|
store_keycode(ongoing_keycode, record);
|
||||||
store_keycode(next_keycode, record);
|
}
|
||||||
|
//return true; // If no clever key was found, process keycode normally.
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void end_CK(keyrecord_t* record) {
|
||||||
|
if (processingCK) {
|
||||||
|
processingCK = false;
|
||||||
|
record->event.pressed = false;
|
||||||
|
process_record(record);
|
||||||
}
|
}
|
||||||
return true; // If no clever key was found, process keycode normally.
|
|
||||||
}
|
}
|
||||||
|
|
@ -32,17 +32,17 @@ extern unsigned short int bkspc_countdown;
|
||||||
|
|
||||||
void clear_recent_keys(void);
|
void clear_recent_keys(void);
|
||||||
void recent_keys_task(void);
|
void recent_keys_task(void);
|
||||||
uint16_t get_next_keycode(uint16_t keycode, keyrecord_t* record);
|
uint16_t get_ongoing_keycode(uint16_t keycode, keyrecord_t* record);
|
||||||
|
|
||||||
void store_keycode(uint16_t keycode, keyrecord_t* record);
|
void store_keycode(uint16_t keycode, keyrecord_t* record);
|
||||||
void process_key(uint16_t keycode, keyrecord_t* record);
|
void process_key(uint16_t keycode, keyrecord_t* record);
|
||||||
void invoke_key(uint16_t keycode, keyrecord_t* record);
|
void invoke_key(uint16_t keycode, keyrecord_t* record);
|
||||||
bool replace_next_key(uint16_t keycode, keyrecord_t* record);
|
void replace_ongoing_key(uint16_t clever_keycode, uint16_t* ongoing_keycode, keyrecord_t* record);
|
||||||
void process_word(uint16_t keycodes[], uint8_t num_keycodes, keyrecord_t* record);
|
void process_word(uint16_t keycodes[], uint8_t num_keycodes, keyrecord_t* record);
|
||||||
bool finish_word(uint16_t keycodes[], uint8_t num_keycodes, keyrecord_t* record);
|
void finish_word(uint16_t keycodes[], uint8_t num_keycodes, uint16_t* ongoing_keycode, keyrecord_t* record);
|
||||||
bool finish_magic(uint16_t keycodes[], uint8_t num_keycodes, keyrecord_t* record);
|
|
||||||
|
|
||||||
bool process_clever_keys(uint16_t keycode, keyrecord_t* record);
|
bool process_clever_keys(uint16_t keycode, keyrecord_t* record);
|
||||||
|
void end_CK(keyrecord_t* record);
|
||||||
|
|
||||||
//bool process_accent(uint16_t accent, uint16_t letter, keyrecord_t* record);
|
//bool process_accent(uint16_t accent, uint16_t letter, keyrecord_t* record);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,8 @@ enum combos {
|
||||||
PANIC,
|
PANIC,
|
||||||
NUMWRD,
|
NUMWRD,
|
||||||
ALTTAB,
|
ALTTAB,
|
||||||
CTRLALT
|
//CTRLALT,
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const uint16_t PROGMEM del_combo_d[] = {FG_S, FG_N, COMBO_END};
|
const uint16_t PROGMEM del_combo_d[] = {FG_S, FG_N, COMBO_END};
|
||||||
|
|
@ -50,7 +51,7 @@ const uint16_t PROGMEM help_combo[] = {FG_VIRG, FG_APOS, COMBO_END};
|
||||||
const uint16_t PROGMEM panic_combo[] = {FG_EACU, FG_L, COMBO_END};
|
const uint16_t PROGMEM panic_combo[] = {FG_EACU, FG_L, COMBO_END};
|
||||||
const uint16_t PROGMEM numword_combo[] = {FG_S, FG_R, COMBO_END};
|
const uint16_t PROGMEM numword_combo[] = {FG_S, FG_R, COMBO_END};
|
||||||
const uint16_t PROGMEM alttab_combo[] = {FG_D, FG_Y, COMBO_END};
|
const uint16_t PROGMEM alttab_combo[] = {FG_D, FG_Y, COMBO_END};
|
||||||
const uint16_t PROGMEM ctrlaFG_Combo[] = {FG_A, FG_I, FG_T, COMBO_END};
|
//const uint16_t PROGMEM ctrlalt_Combo[] = {FG_A, FG_I, FG_T, COMBO_END};
|
||||||
|
|
||||||
combo_t key_combos[] = {
|
combo_t key_combos[] = {
|
||||||
[R_BKSPC] = COMBO(bkspc_combo_d, KC_BSPC),
|
[R_BKSPC] = COMBO(bkspc_combo_d, KC_BSPC),
|
||||||
|
|
@ -67,7 +68,7 @@ combo_t key_combos[] = {
|
||||||
[PANIC] = COMBO(panic_combo, RAZ),
|
[PANIC] = COMBO(panic_combo, RAZ),
|
||||||
[NUMWRD] = COMBO(numword_combo, NUMWORD),
|
[NUMWRD] = COMBO(numword_combo, NUMWORD),
|
||||||
[ALTTAB] = COMBO(alttab_combo, KC_NO),
|
[ALTTAB] = COMBO(alttab_combo, KC_NO),
|
||||||
[CTRLALT] = COMBO(ctrlaFG_Combo, RCTL(RALT(KC_DEL)))
|
//[CTRLALT] = COMBO(ctrlalt_Combo, RCTL(RALT(KC_DEL)))
|
||||||
};
|
};
|
||||||
|
|
||||||
/* uint16_t get_combo_term(uint16_t combo_index, combo_t *combo) {
|
/* uint16_t get_combo_term(uint16_t combo_index, combo_t *combo) {
|
||||||
|
|
@ -120,13 +121,15 @@ bool process_combo_key_repress(uint16_t combo_index, combo_t *combo, uint8_t key
|
||||||
switch (combo_index) {
|
switch (combo_index) {
|
||||||
case ALTTAB:
|
case ALTTAB:
|
||||||
switch (keycode) {
|
switch (keycode) {
|
||||||
case FG_Y:
|
case FG_Y:
|
||||||
tap_code16(S(KC_TAB));
|
tap_code16(S(KC_TAB));
|
||||||
return true;
|
return true;
|
||||||
case FG_D:
|
case FG_D:
|
||||||
tap_code(KC_TAB);
|
tap_code(KC_TAB);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -66,7 +66,8 @@ bool process_odk_layer(uint16_t keycode, keyrecord_t *record) {
|
||||||
case FG_ECIR:
|
case FG_ECIR:
|
||||||
case OU_GRV:
|
case OU_GRV:
|
||||||
case FG_CCED:
|
case FG_CCED:
|
||||||
case AGRV_SPC:
|
//case CA_CED:
|
||||||
|
//case AGRV_SPC:
|
||||||
case KC_SPC: // When space is added by Clever Keys
|
case KC_SPC: // When space is added by Clever Keys
|
||||||
case FG_3PTS:
|
case FG_3PTS:
|
||||||
case CNL_ODK:
|
case CNL_ODK:
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,8 @@ bool isLetter(uint16_t keycode) {
|
||||||
|
|
||||||
bool isSendStringMacro(uint16_t keycode) {
|
bool isSendStringMacro(uint16_t keycode) {
|
||||||
switch (keycode) {
|
switch (keycode) {
|
||||||
case AGRV_SPC:
|
//case AGRV_SPC:
|
||||||
|
//case CA_CED:
|
||||||
case OU_GRV:
|
case OU_GRV:
|
||||||
case MAGIC:
|
case MAGIC:
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -217,6 +218,9 @@ uint16_t get_alt_repeat_key_keycode_user(uint16_t keycode, uint8_t mods) {
|
||||||
case C(FG_Y):
|
case C(FG_Y):
|
||||||
return C(FG_Z);
|
return C(FG_Z);
|
||||||
}
|
}
|
||||||
|
if ((get_mods() | get_weak_mods()) & MOD_BIT(KC_ALGR)) {
|
||||||
|
return KC_SPC;
|
||||||
|
}
|
||||||
|
|
||||||
keycode = tap_hold_extractor(keycode);
|
keycode = tap_hold_extractor(keycode);
|
||||||
if (isLetter(keycode)) { return MAGIC; }
|
if (isLetter(keycode)) { return MAGIC; }
|
||||||
|
|
|
||||||
|
|
@ -116,6 +116,7 @@ void post_process_record_user(uint16_t keycode, keyrecord_t* record) {
|
||||||
os4a_layer_exit_check();
|
os4a_layer_exit_check();
|
||||||
numword_exit_check();
|
numword_exit_check();
|
||||||
odk_layer_exit_check(keycode);
|
odk_layer_exit_check(keycode);
|
||||||
|
end_CK(record);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -200,7 +201,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||||
*/
|
*/
|
||||||
[_R_MODS] = LAYOUT(
|
[_R_MODS] = LAYOUT(
|
||||||
_______, _______, _______, _______, _______, _______, KC_NO, KC_RGUI, OS_WIN, TG_APOD, KC_NO, KC_NO,
|
_______, _______, _______, _______, _______, _______, KC_NO, KC_RGUI, OS_WIN, TG_APOD, KC_NO, KC_NO,
|
||||||
_______, _______, _______, _______, _______, _______, TT_FA, OS_SHFT, OS_CTRL, NUMWORD, FG_ODK, KC_NO,
|
_______, _______, _______, _______, _______, _______, TT_FA, OS_SHFT, OS_CTRL, NUMWORD, FG_ODK, KC_NO,
|
||||||
_______, _______, _______, _______, _______, _______, _______, _______, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, OS_FA, OS_LALT, KC_NO,
|
_______, _______, _______, _______, _______, _______, _______, _______, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, OS_FA, OS_LALT, KC_NO,
|
||||||
_______, _______, _______, _______, _______, _______, _______, _______, KC_NO, KC_NO
|
_______, _______, _______, _______, _______, _______, _______, _______, KC_NO, KC_NO
|
||||||
),
|
),
|
||||||
|
|
@ -223,8 +224,8 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||||
*/
|
*/
|
||||||
[_NUMBERS] = LAYOUT(
|
[_NUMBERS] = LAYOUT(
|
||||||
_______, _______, FG_ASTX, FG_EGAL, KC_7, FG_PERC, S(FG_ACIR), _______, FG_PLUS, FG_MOIN, _______, _______,
|
_______, _______, FG_ASTX, FG_EGAL, KC_7, FG_PERC, S(FG_ACIR), _______, FG_PLUS, FG_MOIN, _______, _______,
|
||||||
_______, KC_6, KC_4, KC_2, MT_SLSH, _______, FG_CARN, MT_1, KC_3, KC_5, KC_7, _______,
|
_______, KC_4, KC_3, KC_2, MT_1, _______, FG_CARN, MT_SLSH, KC_6, KC_7, KC_8, _______,
|
||||||
_______, _______, _______, _______, KC_8, _______, _______, _______, _______, _______, _______, KC_9, KC_6, _______, FG_ODK, _______,
|
_______, _______, _______, _______, KC_5, _______, _______, _______, _______, _______, _______, KC_9, KC_6, _______, FG_ODK, _______,
|
||||||
_______, _______, KC_PDOT, KC_0 , NUMWORD, LT_REPT, KC_SPC, _______, _______, _______
|
_______, _______, KC_PDOT, KC_0 , NUMWORD, LT_REPT, KC_SPC, _______, _______, _______
|
||||||
),
|
),
|
||||||
|
|
||||||
|
|
@ -244,10 +245,10 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||||
* `----------------------------------' `----------------------------------'
|
* `----------------------------------' `----------------------------------'
|
||||||
*/
|
*/
|
||||||
[_ODK] = LAYOUT(
|
[_ODK] = LAYOUT(
|
||||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
|
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
|
||||||
_______, OU_GRV, _______, _______, FG_3PTS, _______, _______, FG_J, FG_D, FG_AROB, _______, _______,
|
_______, OU_GRV, _______, _______, FG_3PTS, _______, _______, FG_J, FG_D, FG_AROB, _______, _______,
|
||||||
_______, _______, _______, _______, FG_F, _______, _______, _______, _______, _______, _______, FG_CCED, _______, FG_K, CNL_ODK, _______,
|
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, FG_CCED, _______, FG_K, CNL_ODK, _______,
|
||||||
_______, _______, _______, _______, FG_ECIR, _______, AGRV_SPC, _______, _______, _______
|
_______, _______, _______, _______, FG_ECIR, _______, _______, _______, _______, _______
|
||||||
),
|
),
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -266,9 +267,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||||
* `----------------------------------' `----------------------------------'
|
* `----------------------------------' `----------------------------------'
|
||||||
*/
|
*/
|
||||||
[_SHORTNAV] = LAYOUT(
|
[_SHORTNAV] = LAYOUT(
|
||||||
_______, KC_BSPC, LWIN(KC_TAB), LWIN(FG_V), RCS(FG_V), _______, KC_PGUP, C(KC_LEFT), KC_UP, C(KC_RGHT), _______, _______,
|
_______, KC_BSPC, LWIN(KC_TAB), LWIN(FG_V), RCS(FG_V), KC_VOLU, KC_PGUP, C(KC_LEFT), KC_UP, C(KC_RGHT), _______, _______,
|
||||||
_______, C(FG_A), C(FG_X), C(FG_V), SFT_T(COPY), _______, KC_PGDN, KC_LEFT, KC_DOWN, KC_RIGHT, KC_F2 , _______,
|
_______, C(FG_A), C(FG_X), C(FG_V), SFT_T(COPY), KC_VOLD, KC_PGDN, KC_LEFT, KC_DOWN, KC_RIGHT, KC_F2 , _______,
|
||||||
_______, KC_SPC, KC_SPC, KC_SPC, C(FG_Z), C(FG_Y), _______, _______, _______, _______, _______, KC_VOLD, KC_VOLU, KC_MUTE, _______, _______,
|
_______, KC_SPC, KC_SPC, KC_MUTE, C(FG_Z), C(FG_Y), _______, _______, _______, _______, _______, C(KC_PGUP), C(KC_PGDN), C(FG_W), _______, _______,
|
||||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______
|
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______
|
||||||
),
|
),
|
||||||
|
|
||||||
|
|
@ -289,7 +290,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||||
[_FUNCAPPS] = LAYOUT(
|
[_FUNCAPPS] = LAYOUT(
|
||||||
_______, KC_F12, KC_F9, KC_F8, KC_F7, QK_BOOT, _______, SWIN(KC_LEFT), LWIN(KC_UP), SWIN(KC_RIGHT), KC_NUM, _______,
|
_______, KC_F12, KC_F9, KC_F8, KC_F7, QK_BOOT, _______, SWIN(KC_LEFT), LWIN(KC_UP), SWIN(KC_RIGHT), KC_NUM, _______,
|
||||||
_______, KC_F11, KC_F6, KC_F5, SFT_T(KC_F4), C(KC_PAUS), TT_FA, LWIN(KC_LEFT), RCTL_T(FEN_B), LWIN(KC_RIGHT), A(KC_ESC), _______,
|
_______, KC_F11, KC_F6, KC_F5, SFT_T(KC_F4), C(KC_PAUS), TT_FA, LWIN(KC_LEFT), RCTL_T(FEN_B), LWIN(KC_RIGHT), A(KC_ESC), _______,
|
||||||
_______, ALT_T(KC_F10), KC_F3, KC_F2, KC_F1, _______, _______, _______, _______, _______, _______, C(KC_PGUP), A(KC_ESC), C(KC_PGDN), _______, _______,
|
_______, ALT_T(KC_F10), KC_F3, KC_F2, KC_F1, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
|
||||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______
|
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______
|
||||||
),
|
),
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -50,16 +50,16 @@ enum custom_keycodes {
|
||||||
OS4A,
|
OS4A,
|
||||||
RAZ,
|
RAZ,
|
||||||
CAPSWORD,
|
CAPSWORD,
|
||||||
AGRV_SPC,
|
//AGRV_SPC,
|
||||||
OU_GRV,
|
OU_GRV,
|
||||||
//E_CIRC,
|
//E_CIRC,
|
||||||
/* I_CIRC,
|
/* I_CIRC,
|
||||||
A_CIRC,
|
A_CIRC,
|
||||||
O_CIRC,
|
O_CIRC,
|
||||||
U_CIRC,
|
U_CIRC,
|
||||||
I_TREM, */
|
I_TREM,
|
||||||
//CA_CED,
|
CA_CED,
|
||||||
/* CIRC,
|
CIRC,
|
||||||
TILDE,
|
TILDE,
|
||||||
GRAVE, */
|
GRAVE, */
|
||||||
MAGIC,
|
MAGIC,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue