Changement philosophie pour [À, !, ?, :]

This commit is contained in:
Kawamashi 2025-08-26 14:13:08 +02:00
commit 2186afa81a
12 changed files with 96 additions and 144 deletions

View file

@ -30,38 +30,34 @@ void get_clever_keycode(uint16_t* next_keycode, keyrecord_t* record) {
//apostrophe = true;
}
if (is_letter(*next_keycode) || is_send_string_macro(*next_keycode)) {
switch (prev_keycode) {
case PG_EXCL:
case PG_QUES:
case PG_3PTS:
case PG_2PTS:
// Add space between punctuation and letters.
invoke_key(KC_SPC, record);
if (is_followed_by_apos(*next_keycode, prev_keycode)) {
set_last_keycode(PG_APOS);
//apostrophe = true;
} else {
set_last_keycode(*next_keycode);
}
case KC_SPC:
switch (recent[RECENT_SIZE - 2]) {
case PG_EXCL:
case PG_QUES:
case PG_3PTS:
case PG_POIN:
// Shift the letter at the beginning of sentences.
if (!is_caps_lock_on()) { add_weak_mods(MOD_BIT(KC_LSFT)); }
break;
}
}
}
switch (prev_keycode) {
case NNB_SPC:
switch (*next_keycode) {
// Shift auto de la ponctuation après une espace fine insécable
case PG_POIN:
process_word((uint16_t[]) {KC_BSPC, SAGR(KC_SPC)}, 2, record);
case PG_TIRE:
case PG_VIRG:
return replace_ongoing_key(S(*next_keycode), next_keycode, record);
}
break;
case KC_SPC:
switch (recent[RECENT_SIZE - 2]) {
case PG_EXCL:
case PG_QUES:
case PG_3PTS:
case PG_POIN:
// Shift the letter at the beginning of sentences.
if (is_letter(*next_keycode) || is_send_string_macro(*next_keycode)) {
if (!is_caps_lock_on()) { add_weak_mods(MOD_BIT(KC_LSFT)); }
break;
}
}
break;
case PG_Q:
switch (*next_keycode) {
@ -105,82 +101,46 @@ void get_clever_keycode(uint16_t* next_keycode, keyrecord_t* record) {
return finish_word((uint16_t[]) {PG_L, PG_U, PG_S}, 3, next_keycode, record);
}
break;
/* case PG_OE:
// "œu"
if (*next_keycode == PG_Z) {
bkspc_countdown = 0;
return replace_ongoing_key(PG_U, next_keycode, record);
}
break; */
}
switch (*next_keycode) {
case PG_QUES:
case PG_EXCL:
// On ajoute un espace insécable s'il n'a pas été entré avant le point d'exclamation.
// Il ne faut pas tester cette fonctionnalité avec Word, qui ajoute cet espace automatiquement.
if (is_letter(recent[RECENT_SIZE - 1])) {
invoke_key(KC_SPC, record);
return replace_ongoing_key(*next_keycode, next_keycode, record);
}
break;
case MAGIC:
if (!is_letter(prev_keycode)) {
// "à"
process_key(PG_ODK,record);
if (is_shifted) {
is_shifted = false;
add_weak_mods(MOD_BIT(KC_LSFT));
}
return replace_ongoing_key(PG_A, next_keycode, record);
}
switch (prev_keycode) {
case PG_O:
// oui
invoke_key(PG_U, record);
case PG_U:
// ui SFB
//bkspc_countdown = 0;
return replace_ongoing_key(PG_I, next_keycode, record);
case PG_L:
/* case PG_L:
// là
return finish_word((uint16_t[]) {PG_ODK, PG_A}, 2, next_keycode, record);
return finish_word((uint16_t[]) {PG_ODK, PG_A}, 2, next_keycode, record); */
case PG_EACU:
// éa SFB
//bkspc_countdown = 0;
return replace_ongoing_key(PG_A, next_keycode, record);
case PG_S:
// sc SFB
//bkspc_countdown = 0;
return replace_ongoing_key(PG_C, next_keycode, record);
case PG_C:
// cs SFB
//bkspc_countdown = 0;
return replace_ongoing_key(PG_S, next_keycode, record);
case PG_N:
// n. SFB
//bkspc_countdown = 0;
return replace_ongoing_key(PG_POIN, next_keycode, record);
case PG_P:
// ph SFB
//bkspc_countdown = 0;
return replace_ongoing_key(PG_H, next_keycode, record);
case PG_G:
// gt SFB
//bkspc_countdown = 0;
return replace_ongoing_key(PG_T, next_keycode, record);
case PG_Q:
@ -191,9 +151,9 @@ void get_clever_keycode(uint16_t* next_keycode, keyrecord_t* record) {
// you bad redirection
return finish_word((uint16_t[]) {PG_O, PG_U}, 2, next_keycode, record);
/* case PG_T:
return finish_word((uint16_t[]) {PG_I, PG_Q, PG_U, PG_E}, 4, next_keycode, record); */
//invoke_key(PG_I, record);
case PG_T:
// "the"
return finish_word((uint16_t[]) {PG_H, PG_E}, 2, next_keycode, record);
case PG_I:
return finish_word((uint16_t[]) {PG_O, PG_N}, 2, next_keycode, record);
@ -216,7 +176,14 @@ void get_clever_keycode(uint16_t* next_keycode, keyrecord_t* record) {
return finish_word((uint16_t[]) {PG_EACU, PG_J, PG_ODK, PG_A}, 4, next_keycode, record);
default:
return;
// "à"
process_key(PG_ODK,record);
if (is_shifted) {
is_shifted = false;
add_weak_mods(MOD_BIT(KC_LSFT));
}
return replace_ongoing_key(PG_A, next_keycode, record);
}
case PG_AROB:
@ -278,14 +245,6 @@ void get_clever_keycode(uint16_t* next_keycode, keyrecord_t* record) {
case PG_APOS:
if (is_apos_dr) { return replace_ongoing_key(PG_APOD, next_keycode, record); }
break;
case PG_Z:
// "œu"
if (prev_keycode == PG_OE) {
bkspc_countdown = 0;
return replace_ongoing_key(PG_U, next_keycode, record);
}
break;
}
}

View file

@ -86,6 +86,11 @@ bool process_macros(uint16_t keycode, keyrecord_t *record) {
set_oneshot_mods(MOD_BIT(KC_LSFT));
}
return true;
case PG_DEG:
tap_code(PG_ODK);
tap_code(KC_9);
return false;
}
}
return true; // Process all other keycodes normally

View file

@ -64,8 +64,9 @@ bool should_exit_num_word(uint16_t keycode, const keyrecord_t *record) {
case PG_EXP:
case PG_IND:
case PG_H:
case ALGR(PG_POIN):
case PG_2PTS:
case LT_EURO:
case NNB_SPC:
// Misc
case KC_BSPC:

View file

@ -47,6 +47,7 @@ bool process_odk_layer(uint16_t keycode, keyrecord_t *record) {
if (IS_LAYER_ON(_ODK)) {
switch (keycode) {
case PG_3PTS: // For Clever Keys
case PG_PVIR:
case PG_AROB:
case PG_K:
case PG_B:

View file

@ -68,7 +68,8 @@ bool process_os4a_layers(uint16_t keycode, keyrecord_t *record) {
// to be processed (ex: custom altgr, clever keys).
uint8_t mods = get_mods() | get_oneshot_mods();
if (!exit_os4a_layer && !pending_OSL && to_be_shifted(keycode, record) && mods == 0) {
add_weak_mods(MOD_BIT(KC_LSFT));
// Don't use weak mods, it interferes with Capsword.
set_oneshot_mods(MOD_BIT(KC_LSFT));
}
return true;
}

View file

@ -59,39 +59,10 @@ __attribute__((weak)) bool forbidden_chord(uint16_t tap_hold_keycode, keyrecord_
}
static bool process_tap_hold(uint16_t keycode, keyrecord_t *record) {
bool process_tap_hold(uint16_t keycode, keyrecord_t *record) {
if (record->event.pressed) { // On press
tap_code16(keycode);
return false;
}
return true;
}
bool process_custom_tap_hold(uint16_t keycode, keyrecord_t *record) {
if (record->tap.count) { // Handling of special tap-hold keys (on tap).
switch (keycode) {
/* case ALGR_T(PG_CACL):
return process_tap_hold(PG_CACL, record); */
case RCTL_T(FEN_B):
return process_tap_hold(LWIN(KC_DOWN), record);
case SFT_T(COPY):
return process_tap_hold(C(PG_C), record);
/* case LT_NUMWORD:
return process_numword(NUMWORD, record); */
case LT_REPT:
repeat_key_invoke(&record->event);
return false;
case LT_MGC:
alt_repeat_key_invoke(&record->event);
return false;
}
}
return true; // Process all other keycodes normally
}

View file

@ -29,7 +29,7 @@ bool same_side_combination(const keyrecord_t* tap_hold_record, const keyrecord_t
void tap_converter(uint16_t keycode, keyrecord_t *record);
bool process_custom_tap_hold(uint16_t keycode, keyrecord_t *record);
bool process_tap_hold(uint16_t keycode, keyrecord_t *record);
#ifdef __cplusplus
}

View file

@ -38,6 +38,7 @@ bool is_send_string_macro(uint16_t keycode) {
switch (keycode) {
case OU_GRV:
case MAGIC:
//case PG_DEG:
return true;
default:
@ -73,6 +74,32 @@ uint16_t tap_hold_extractor(uint16_t keycode) {
}
}
bool process_custom_tap_hold(uint16_t keycode, keyrecord_t *record) {
if (record->tap.count) { // Handling of special tap-hold keys (on tap).
switch (keycode) {
case RCTL_T(FEN_B):
return process_tap_hold(LWIN(KC_DOWN), record);
case SFT_T(COPY):
return process_tap_hold(C(PG_C), record);
/* case LT_NUMWORD:
return process_numword(NUMWORD, record); */
case LT_REPT:
repeat_key_invoke(&record->event);
return false;
case LT_MGC:
alt_repeat_key_invoke(&record->event);
return false;
}
}
return true; // Process all other keycodes normally
}
// Caps Word
@ -151,8 +178,6 @@ uint16_t get_ongoing_keycode_user(uint16_t keycode) {
case PG_3PTS:
case KC_SPC: // In order to uppercase J after '?' for ex.
return keycode;
case PG_Q:
return PG_OE;
default:
clear_recent_keys();
@ -263,21 +288,10 @@ uint16_t get_alt_repeat_key_keycode_user(uint16_t keycode, uint8_t mods) {
case C(PG_Y):
return C(PG_Z);
}
/* if ((get_mods() | get_weak_mods()) & MOD_BIT(KC_ALGR)) {
return KC_SPC;
} */
if (recent[RECENT_SIZE - 1] != KC_NO) { return MAGIC; }
/* keycode = tap_hold_extractor(keycode);
if (is_letter(keycode)) { return MAGIC; }
switch (keycode) {
case PG_APOS:
case KC_SPC:
case
} */
if (get_last_keycode() == KC_NO) { return MAGIC; }
return KC_TRNS; // Defer to default definitions.
}

View file

@ -25,6 +25,8 @@ bool is_send_string_macro(uint16_t keycode);
bool is_followed_by_apos(uint16_t keycode, uint16_t prev_keycode);
uint16_t tap_hold_extractor(uint16_t keycode);
bool process_custom_tap_hold(uint16_t keycode, keyrecord_t *record);
uint16_t get_ongoing_keycode_user(uint16_t keycode);
uint8_t get_os4a_layer(uint16_t keycode);

View file

@ -111,11 +111,9 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
}
void post_process_record_user(uint16_t keycode, keyrecord_t* record) {
//if (os4a_layer != 0 && exit_os4a_layer) { os4a_layer_off(os4a_layer); }
os4a_layer_exit_check();
numword_exit_check();
//odk_layer_exit_check(keycode);
end_CK(record);
}
@ -183,7 +181,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
_______, _______, _______, _______, _______, _______, KC_NO, KC_RGUI, OS_WIN, KC_NO, KC_NO, KC_NO,
_______, _______, _______, _______, _______, _______, TT_FA, OS_SHFT, OS_CTRL, NUMWORD, NUM_ODK, KC_NO,
_______, _______, _______, _______, _______, _______, _______, _______, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, OS_FA, OS_LALT, KC_NO,
_______, _______, _______, _______, _______, TG_APOS, _______, _______, KC_NO, KC_NO
_______, _______, _______, _______, MAGIC, TG_APOS, _______, _______, KC_NO, KC_NO
),
@ -203,7 +201,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
*/
[_SYMBOLS] = LAYOUT(
_______, PG_ACIR, PG_LCBR, PG_RCBR, PG_DLR, PG_PERC, PG_HASH, PG_DQUO, PG_EGAL, ALGR(PG_J), PG_GRV, _______,
_______, ALGR(PG_O), PG_LPRN, PG_RPRN, PG_PVIR, ALGR(PG_POIN), PG_BSLS, MT_SLSH, PG_MOIN, PG_PLUS, PG_ASTX, _______,
_______, ALGR(PG_O), PG_LPRN, PG_RPRN, PG_PVIR, PG_2PTS, PG_BSLS, MT_SLSH, PG_MOIN, PG_PLUS, PG_ASTX, _______,
_______, PG_INF, PG_LSBR, PG_RSBR, PG_SUP, _______, _______, _______, _______, _______, _______, PG_APOD, PG_ESPR, PG_PIPE, PG_TILD, _______,
_______, _______, _______, PG_UNDS, KC_SPC, _______, _______, _______, _______, _______
),
@ -225,9 +223,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
*/
[_NUMBERS] = LAYOUT(
_______, PG_DLR, PG_MOIN, PG_PLUS, _______, PG_PERC, PG_EXP, _______, PG_EGAL, PG_ASTX, _______, _______,
_______, KC_4, KC_3, KC_2, MT_1, ALGR(PG_POIN), PG_IND, MT_SLSH, KC_6, KC_7, KC_8, _______,
_______, _______, _______, PG_H, KC_5, _______, _______, _______, _______, _______, _______, KC_9, _______, _______, PG_ODK, _______,
_______, _______, KC_PDOT, KC_0 , LT_EURO, LT_REPT, KC_SPC, KC_PDOT, _______, _______
_______, KC_4, KC_3, KC_2, MT_1, PG_2PTS, PG_IND, MT_SLSH, KC_6, KC_7, KC_8, _______,
_______, _______, _______, PG_H, KC_5, _______, _______, _______, _______, _______, _______, KC_9, PG_DEG, _______, PG_ODK, _______,
_______, _______, KC_PDOT, KC_0 , LT_EURO, NNB_SPC, KC_SPC, KC_PDOT, _______, _______
),
@ -247,7 +245,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
*/
[_ODK] = LAYOUT(
_______, _______, _______, _______, _______, PG_T, _______, _______, _______, _______, _______, _______,
_______, OU_GRV, _______, _______, _______, PG_3PTS, _______, PG_K, _______, _______, _______, _______,
_______, OU_GRV, _______, _______, PG_PVIR, PG_3PTS, _______, PG_K, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, PG_AROB, CNL_ODK, _______,
_______, _______, _______, _______, PG_O, PG_APOS, PG_B, _______, _______, _______
),

View file

@ -51,7 +51,7 @@ enum custom_keycodes {
RAZ,
CAPSWORD,
OU_GRV,
PG_OE,
//PG_OE,
//E_CIRC,
/* I_CIRC,
A_CIRC,
@ -66,8 +66,8 @@ enum custom_keycodes {
OS_WIN,
//OS_ODK,
CNL_ODK,
TG_APOS
TG_APOS,
PG_DEG
};
// Layer taps

View file

@ -76,8 +76,8 @@
#define PG_S KC_K // S
#define PG_R KC_L // R
#define PG_L KC_SCLN // L
#define PG_APOS KC_QUOT //
#define PG_EURO KC_NUHS // €
#define PG_EURO KC_QUOT // €
#define PG_APOS KC_NUHS //
// Row 4
#define PG_E KC_NUBS // E
@ -131,14 +131,14 @@
// Row 3
#define PG_2PTS S(PG_POIN) // :
#define PG_LSBR S(PG_APOS) // [
#define PG_RSBR S(PG_EURO) // ]
#define PG_RSBR S(PG_APOS) // ]
#define PG_LSBR S(PG_EURO) // [
// Row 4
#define PG_PVIR S(PG_ODK)
// Row 5
#define PG_NBSP S(KC_SPC) // Espace insecable
#define NNB_SPC S(KC_SPC) // Espace fine insecable