avt maj ODK

This commit is contained in:
Kawamashi 2025-08-03 14:14:29 +02:00
commit 9875370c16
10 changed files with 126 additions and 120 deletions

View file

@ -24,51 +24,11 @@ void get_clever_keycode(uint16_t* next_keycode, keyrecord_t* record) {
uint16_t prev_keycode = recent[RECENT_SIZE - 1];
//static bool is_shifted = false;
// Inversion du point et de la virgule
static bool inversion = false;
if (*next_keycode == PG_POIN) {
replace_ongoing_key(PG_VIRG, next_keycode, record);
inversion = true;
}
if (inversion == false && *next_keycode == PG_VIRG) { replace_ongoing_key(PG_POIN, next_keycode, record); }
inversion = false;
static bool apostrophe = false;
if (IS_LAYER_ON(_BASE) && *next_keycode == PG_APOS) {
if (apostrophe) {
apostrophe = false;
} else {
replace_ongoing_key(PG_MOIN, next_keycode, record);
}
}
apostrophe = false;
// Apostrophe
if (is_followed_by_apos(*next_keycode, prev_keycode)) {
set_last_keycode(PG_APOS);
apostrophe = true;
//apostrophe = true;
}
/* switch (*next_keycode) {
case PG_Q:
set_last_keycode(PG_APOS);
apostrophe = true;
break;
case PG_L:
case PG_T:
case PG_D:
case PG_C:
case PG_N:
case PG_S:
case PG_M:
case PG_Y:
case PG_J:
//if (!is_letter(prev_keycode)) { set_last_keycode(PG_APOS); }
if (!is_letter(prev_keycode)) {
set_last_keycode(PG_APOS);
apostrophe = true;
}
} */
if (is_letter(*next_keycode) || is_send_string_macro(*next_keycode)) {
switch (prev_keycode) {
@ -81,7 +41,7 @@ void get_clever_keycode(uint16_t* next_keycode, keyrecord_t* record) {
if (is_followed_by_apos(*next_keycode, prev_keycode)) {
set_last_keycode(PG_APOS);
apostrophe = true;
//apostrophe = true;
} else {
set_last_keycode(*next_keycode);
}
@ -145,6 +105,14 @@ 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; */
}
@ -229,8 +197,10 @@ 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:
invoke_key(PG_I, 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_I:
return finish_word((uint16_t[]) {PG_O, PG_N}, 2, next_keycode, record);
@ -285,6 +255,9 @@ void get_clever_keycode(uint16_t* next_keycode, keyrecord_t* record) {
// "mh" -> "mb"
bkspc_countdown = 0;
return replace_ongoing_key(PG_B, next_keycode, record);
} else if (prev_keycode == PG_I) {
// "ih" -> "ique"
return finish_word((uint16_t[]) {PG_Q, PG_U, PG_E}, 3, next_keycode, record);
}
break;
@ -311,6 +284,14 @@ 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

@ -73,8 +73,11 @@ uint16_t get_ongoing_keycode(uint16_t keycode, keyrecord_t* record) {
}
// Handles custom keycodes.
if (is_send_string_macro(keycode)) { return keycode; }
//if (keycode == PG_CCED) { return PG_CCED; }
uint16_t custom_keycode = get_ongoing_keycode_user(keycode);
if (custom_keycode != KC_TRNS) { return custom_keycode; }
/* if (is_send_string_macro(keycode)) { return keycode; }
if (IS_LAYER_ON(_ODK)) {
switch (keycode) {
case PG_K:
@ -83,15 +86,12 @@ uint16_t get_ongoing_keycode(uint16_t keycode, keyrecord_t* record) {
case PG_3PTS:
case KC_SPC: // In order to uppercase J after '?' for ex.
return keycode;
case PG_VIRG:
return PG_3PTS;
/* case PG_T:
return PG_MOIN; */
default:
clear_recent_keys();
return KC_NO;
}
}
} */
uint8_t basic_keycode = keycode;
// Handle keys carrying a modifier, for ex on layers(! and ?).

View file

@ -55,14 +55,17 @@ bool should_exit_num_word(uint16_t keycode, const keyrecord_t *record) {
// Numpad keycodes
case KC_1 ... KC_0:
case KC_PDOT:
case PG_X:
//case PG_X:
//case PG_EACU:
case PG_MOIN:
case PG_ASTX:
case PG_PLUS:
case PG_SLSH:
case PG_ACIR:
case PG_CARN:
case PG_EXP:
case PG_IND:
case PG_H:
case ALGR(PG_POIN):
case LT_EURO:
// Misc
case KC_BSPC:

View file

@ -60,13 +60,7 @@ bool process_odk_layer(uint16_t keycode, keyrecord_t *record) {
default:
tap_code(PG_ODK);
}
if (!is_apos_dr) {
switch (keycode) {
case PG_M:
case PG_C:
is_shifted = true;
}
}
if (is_shifted) {
is_shifted = false;
//set_mods(mods);

View file

@ -81,8 +81,8 @@ bool process_custom_tap_hold(uint16_t keycode, keyrecord_t *record) {
case SFT_T(COPY):
return process_tap_hold(C(PG_C), record);
case LT_NUMWORD:
return process_numword(NUMWORD, record);
/* case LT_NUMWORD:
return process_numword(NUMWORD, record); */
case LT_REPT:
repeat_key_invoke(&record->event);

View file

@ -21,13 +21,11 @@ bool is_caps_lock_on(void) { return host_keyboard_led_state().caps_lock; }
bool is_letter(uint16_t keycode) {
switch (keycode) {
case KC_A ... KC_F:
case KC_H ... KC_N:
case KC_R ... KC_Z:
case KC_H ... KC_P:
case KC_R ... KC_S:
case KC_U ... KC_Z:
case PG_L:
case PG_X:
case PG_E:
//case PG_AGR:
//case PG_ECIR:
case KC_GRV ... KC_DOT:
return true;
@ -39,7 +37,6 @@ bool is_letter(uint16_t keycode) {
bool is_send_string_macro(uint16_t keycode) {
switch (keycode) {
case OU_GRV:
//case PG_BL:
case MAGIC:
return true;
@ -84,7 +81,7 @@ bool caps_word_press_user(uint16_t keycode) {
// Caps Word shouldn't be applied with Alt-gr
// Managing underscore and slash on alt gr + E/T.
// Underscore and slash must continue Caps Word, without shifting.
if ((get_mods() & MOD_BIT(KC_ALGR))) {
/* if ((get_mods() & MOD_BIT(KC_ALGR))) {
switch (keycode) {
case PG_E:
case PG_T:
@ -92,26 +89,20 @@ bool caps_word_press_user(uint16_t keycode) {
default:
return false;
}
}
} */
if (IS_LAYER_ON(_ODK)) {
switch (keycode) {
case PG_EACU:
case PG_B:
case PG_VIRG:
add_weak_mods(MOD_BIT(KC_LSFT)); // Apply shift to next key.
return true;
case PG_I:
case PG_F:
case PG_Y:
case PG_T:
return true;
case PG_L:
case PG_H:
case PG_VIRG:
case PG_V:
case PG_M:
case PG_C:
//case PG_T:
case PG_S:
case PG_POIN:
return false;
}
}
@ -128,11 +119,13 @@ bool caps_word_press_user(uint16_t keycode) {
case PG_ODK:
//case PG_GRV:
case PG_UNDS:
case PG_MOIN:
case PG_TIRE:
case PG_SLSH:
case KC_KP_1 ... KC_KP_0:
case KC_LEFT:
case KC_RIGHT:
case KC_BSPC:
case LCTL(KC_BSPC):
case KC_DEL:
case PG_APOS:
return true;
@ -142,6 +135,33 @@ bool caps_word_press_user(uint16_t keycode) {
}
}
// Clever keys configuration
uint16_t get_ongoing_keycode_user(uint16_t keycode) {
// Handles custom keycodes to be processed for Clever Keys
if (is_send_string_macro(keycode)) { return keycode; }
if (IS_LAYER_ON(_ODK)) {
switch (keycode) {
case PG_K:
case PG_B:
case PG_AROB:
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();
return KC_NO;
}
}
return KC_TRNS;
}
// One-shot 4 all configuration
uint8_t get_os4a_layer(uint16_t keycode) {
@ -192,12 +212,13 @@ bool is_oneshot_cancel_key(uint16_t keycode) {
}
bool is_oneshot_ignored_key(uint16_t keycode) {
// Alt-gr et shift s'appliquent à la touche typo, pour permettre de faire les majuscules plus facilement ainsi que ] avec.
// Autrement, la touche typo est ignorée par les Callum mods.
// On veut que la touche typo soit ignorée par tous les Callum mods sauf Alt-gr.
// Ça permet de transmettre les mods à la touche suivante, par ex pour faire Ctrl + K.
//uint8_t mods = get_mods() | get_weak_mods() | get_oneshot_mods();
// Alt-gr et shift s'appliquent à la touche typo, pour permettre de faire les majuscules plus facilement ainsi que ] avec.
uint8_t mods = get_mods() | get_weak_mods() | get_oneshot_mods();
//if (keycode == OS_ODK && (mods & ~(MOD_MASK_SHIFT | MOD_BIT(KC_ALGR)))) { return true; }
//if (keycode == OS_ODK && (mods & ~MOD_BIT(KC_ALGR))) { return true; }
if (keycode == OS_ODK && (mods & ~MOD_BIT(KC_ALGR))) { return true; }
switch (keycode) {
//case OS_ODK: /!\ A ne pas remettre, sous peine de ne pas pouvoir faire shift + typo + touche de l'autre côté

View file

@ -19,11 +19,13 @@
#include "quantum.h"
#include "keymap.h"
bool is_caps_lock_on(void);
bool is_letter(uint16_t keycode);
bool is_send_string_macro(uint16_t keycode);
bool is_followed_by_apos(uint16_t keycode, uint16_t prev_keycode);
bool is_caps_lock_on(void);
uint16_t tap_hold_extractor(uint16_t keycode);
uint16_t get_ongoing_keycode_user(uint16_t keycode);
uint8_t get_os4a_layer(uint16_t keycode);
bool os4a_layer_changer(uint16_t keycode);

View file

@ -138,9 +138,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* `----------------------------------' `----------------------------------'
*/
[_BASE] = LAYOUT(
KC_NO, PG_POIN, PG_EACU, PG_U, PG_P, PG_APOS, PG_V, PG_M, PG_C, PG_J, PG_X, KC_NO,
KC_NO, PG_O, PG_A, PG_I, PG_N, PG_VIRG, PG_G, PG_T, PG_S, PG_R, PG_L, KC_NO,
KC_NO, PG_Q, PG_Z, PG_Y, PG_H, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, PG_D, PG_F, PG_W, OS_ODK, KC_NO,
KC_NO, PG_VIRG, PG_EACU, PG_U, PG_P, PG_TIRE, PG_V, PG_M, PG_C, PG_J, PG_X, KC_NO,
KC_NO, PG_O, PG_A, PG_I, PG_N, PG_POIN, PG_G, PG_T, PG_S, PG_R, PG_L, KC_NO,
KC_NO, PG_Q, PG_Z, PG_Y, PG_H, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, PG_D, PG_F, PG_W, OS_ODK, KC_NO,
KC_NO, KC_SPC, L_OS4A, LT_E, LT_MGC, LT_REPT, LT_SPC, R_OS4A, KC_RGUI, KC_NO
),
@ -202,10 +202,10 @@ 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_APOS), PG_GRV, _______,
_______, ALGR(PG_O), PG_LPRN, PG_RPRN, PG_PVIR, ALGR(PG_VIRG), 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, PG_APOS, _______, _______, _______, _______
_______, 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, _______,
_______, PG_INF, PG_LSBR, PG_RSBR, PG_SUP, _______, _______, _______, _______, _______, _______, PG_APOD, PG_ESPR, PG_PIPE, PG_TILD, _______,
_______, _______, _______, PG_UNDS, KC_SPC, _______, _______, _______, _______, _______
),
@ -224,10 +224,10 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* `----------------------------------' `----------------------------------'
*/
[_NUMBERS] = LAYOUT(
_______, PG_DLR, PG_MOIN, PG_PLUS, KC_7, PG_PERC, SAGR(PG_POIN), _______, PG_EGAL, PG_ASTX, _______, _______,
_______, KC_4, KC_3, KC_2, MT_1, ALGR(PG_VIRG), PG_CARN, MT_SLSH, KC_6, KC_7, KC_8, _______,
_______, _______, _______, PG_H, KC_5, _______, _______, _______, _______, _______, _______, KC_9, _______, _______, PG_ODK, _______,
_______, _______, KC_PDOT, KC_0 , LT_NUMWORD, LT_REPT, KC_SPC, KC_PDOT, _______, _______
_______, 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, _______, _______
),
@ -246,8 +246,8 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* `----------------------------------' `----------------------------------'
*/
[_ODK] = LAYOUT(
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, OU_GRV, _______, _______, PG_T, _______, _______, PG_K, _______, _______, _______, _______,
_______, _______, _______, _______, _______, PG_T, _______, _______, _______, _______, _______, _______,
_______, OU_GRV, _______, _______, _______, PG_3PTS, _______, PG_K, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, PG_AROB, CNL_ODK, _______,
_______, _______, _______, _______, PG_O, PG_APOS, PG_B, _______, _______, _______
),

View file

@ -51,6 +51,7 @@ enum custom_keycodes {
RAZ,
CAPSWORD,
OU_GRV,
PG_OE,
//E_CIRC,
/* I_CIRC,
A_CIRC,
@ -78,7 +79,8 @@ enum custom_keycodes {
#define TT_FA TT(_FUNCAPPS)
#define MT_SLSH SFT_T(PG_SLSH)
#define MT_1 SFT_T(KC_1)
#define LT_NUMWORD LT(_SHORTNAV, NUMWORD)
//#define LT_NUMWORD LT(_SHORTNAV, NUMWORD)
#define LT_EURO LT(_SHORTNAV, PG_EURO)
#define E_CIRC S(FG_0)
#define OS_ODK OSL(_ODK)
#define OS_RSA OSM(MOD_RALT | MOD_LSFT)

View file

@ -26,11 +26,11 @@
*
*  `  1  2  3  4  5  6  7  8  9  0  /  =        
*
*       .  É  U  P  B  V  M  C    X  '  -      
*       ,  É  U  P  -  V  M  C  J  X  '  -      
*     
*        O  A  I  N  ,  G  T  S  R  L  [  ]     
*        O  A  I  N  .  G  T  S  R  L         
*
*      E  Q  Z  Y  H  J  K  D  F  W  **          
*      E  Q  Z  Y  H  B  K  D  F  W  **          
*
*                                                     
*
@ -52,15 +52,15 @@
#define PG_EGAL KC_EQL // =
// Row 2
#define PG_POIN KC_Q // .
#define PG_VIRG KC_Q // ,
#define PG_EACU KC_W // É
#define PG_U KC_E // U
#define PG_P KC_R // P
#define PG_B KC_T // B
#define PG_TIRE KC_T // -
#define PG_V KC_Y // V
#define PG_M KC_U // M
#define PG_C KC_I // C
#define PG_APOS KC_O //
#define PG_J KC_O // J
#define PG_X KC_P // X
#define PG_APOD KC_LBRC // '
#define PG_MOIN KC_RBRC // -
@ -70,14 +70,14 @@
#define PG_A KC_S // A
#define PG_I KC_D // I
#define PG_N KC_F // N
#define PG_VIRG KC_G // ,
#define PG_POIN KC_G // .
#define PG_G KC_H // G
#define PG_T KC_J // T
#define PG_S KC_K // S
#define PG_R KC_L // R
#define PG_L KC_SCLN // L
#define PG_LSBR KC_QUOT // [
#define PG_RSBR KC_NUHS // ]
#define PG_APOS KC_QUOT //
#define PG_EURO KC_NUHS // €
// Row 4
#define PG_E KC_NUBS // E
@ -85,7 +85,7 @@
#define PG_Z KC_X // Z
#define PG_Y KC_C // Y
#define PG_H KC_V // H
#define PG_J KC_B // J
#define PG_B KC_B // B
#define PG_K KC_N // K
#define PG_D KC_M // C
#define PG_F KC_COMM // H
@ -97,9 +97,9 @@
*
*  ~  |  <  >  $  %  ^  &  _  #  @  *  \        
*
*       ?                       !     " │ + │     │
*       ?           !                 " │ + │     │
*     
*                    :                          
*                    :                 [  ]     
*
*                                    ;           
*
@ -123,14 +123,16 @@
#define PG_BSLS S(PG_EGAL) // '\'
// Row 2
#define PG_QUES S(PG_POIN) // ?
#define PG_EXCL S(PG_APOS) // !
#define PG_QUES S(PG_VIRG) // ?
#define PG_EXCL S(PG_TIRE) // !
#define PG_DQUO S(PG_APOD) // "
#define PG_PLUS S(PG_MOIN) // +
//#define PG_DIFF S(PG_EGAL) // ≠
// Row 3
#define PG_2PTS S(PG_VIRG) // :
// Row 3
#define PG_2PTS S(PG_POIN) // :
#define PG_LSBR S(PG_APOS) // [
#define PG_RSBR S(PG_EURO) // ]
// Row 4
#define PG_PVIR S(PG_ODK)
@ -206,7 +208,8 @@
*
*/
#define PG_CARN S(ALGR(PG_O)) // ˇ (dead)
#define PG_EXP S(ALGR(PG_VIRG)) // ^ (dead)
#define PG_IND S(ALGR(PG_O)) // ˇ (dead)
/* // Row 1
#define PG_IBRV S(ALGR(PG_AROB)) //  ̑ (dead)
#define PG_HACU S(ALGR(PG_LPRN)) // ˝ (dead)