mirror of
https://github.com/qmk/qmk_userspace.git
synced 2026-03-10 02:10:25 -04:00
typo -> odk
This commit is contained in:
parent
a15227486a
commit
a9c2963cf6
16 changed files with 72 additions and 528 deletions
|
|
@ -169,7 +169,7 @@ bool clever_key_finder(uint16_t next_keycode, keyrecord_t* record) {
|
|||
return finish_magic((uint16_t[]) {FG_E, FG_N, FG_T}, 3, record);
|
||||
} else {
|
||||
// "même"
|
||||
return finish_magic((uint16_t[]) {FG_TYPO, FG_O, FG_M, FG_E}, 4, record);
|
||||
return finish_magic((uint16_t[]) {FG_ODK, FG_O, FG_M, FG_E}, 4, record);
|
||||
}
|
||||
|
||||
default:
|
||||
|
|
@ -182,33 +182,33 @@ bool clever_key_finder(uint16_t next_keycode, keyrecord_t* record) {
|
|||
|
||||
case FG_T:
|
||||
// "t@" -> "toujours"
|
||||
layer_off(_TYPO);
|
||||
layer_off(_ODK);
|
||||
return finish_word((uint16_t[]) {FG_O, FG_U, FG_J, FG_O, FG_U, FG_R, FG_S}, 7, record);
|
||||
|
||||
case FG_P:
|
||||
// "p@" -> "peut-être"
|
||||
layer_off(_TYPO);
|
||||
return finish_word((uint16_t[]) {FG_E, FG_U, FG_T, FG_MOIN, FG_TYPO, FG_O, FG_T, FG_R, FG_E}, 9, record);
|
||||
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);
|
||||
|
||||
case FG_A:
|
||||
// "a@" -> "aujourd'hui"
|
||||
layer_off(_TYPO);
|
||||
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);
|
||||
|
||||
case FG_B:
|
||||
// "b@" -> "beaucoup"
|
||||
layer_off(_TYPO);
|
||||
layer_off(_ODK);
|
||||
return finish_word((uint16_t[]) {FG_E, FG_A, FG_U, FG_C, FG_O, FG_U, FG_P}, 7, record);
|
||||
|
||||
case FG_E:
|
||||
// "e@" -> "est-ce qu"
|
||||
layer_off(_TYPO);
|
||||
layer_off(_ODK);
|
||||
return finish_word((uint16_t[]) {FG_S, FG_T, FG_MOIN, FG_C, FG_E, KC_SPC, FG_Q}, 7, record);
|
||||
|
||||
case FG_D:
|
||||
// "d@" -> "déjà"
|
||||
layer_off(_TYPO);
|
||||
return finish_word((uint16_t[]) {FG_EACU, FG_J, FG_TYPO, FG_A}, 4, record);
|
||||
layer_off(_ODK);
|
||||
return finish_word((uint16_t[]) {FG_EACU, FG_J, FG_ODK, FG_A}, 4, record);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
@ -246,11 +246,11 @@ bool clever_key_finder(uint16_t next_keycode, keyrecord_t* record) {
|
|||
break;
|
||||
|
||||
case OU_GRV:
|
||||
layer_off(_TYPO);
|
||||
return finish_word((uint16_t[]) {FG_O, FG_TYPO, FG_T}, 3, record);
|
||||
layer_off(_ODK);
|
||||
return finish_word((uint16_t[]) {FG_O, FG_ODK, FG_T}, 3, record);
|
||||
|
||||
case AGRV_SPC:
|
||||
layer_off(_TYPO);
|
||||
layer_off(_ODK);
|
||||
return finish_word((uint16_t[]) {FG_AGR, KC_SPC}, 2, record);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ uint16_t get_next_keycode(uint16_t keycode, keyrecord_t* record) {
|
|||
// Handles custom keycodes.
|
||||
if (isSendStringMacro(keycode)) { return keycode; }
|
||||
//if (keycode == FG_CCED) { return FG_CCED; }
|
||||
if (IS_LAYER_ON(_TYPO)) {
|
||||
if (IS_LAYER_ON(_ODK)) {
|
||||
switch (keycode) {
|
||||
case FG_K:
|
||||
case FG_J:
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
#include "macros.h"
|
||||
|
||||
bool is_typo_shifted = false;
|
||||
bool is_odk_shifted = false;
|
||||
|
||||
bool process_macros(uint16_t keycode, keyrecord_t *record) {
|
||||
//const uint8_t mods = get_mods();
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
extern bool is_typo_shifted;
|
||||
extern bool is_odk_shifted;
|
||||
|
||||
bool process_macros(uint16_t keycode, keyrecord_t *record);
|
||||
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ bool should_terminate_num_word(uint16_t keycode, const keyrecord_t *record) {
|
|||
|
||||
// Misc
|
||||
case KC_BSPC:
|
||||
case FG_TYPO: // Not to exit Numword when chording it with Typo
|
||||
case FG_ODK: // Not to exit Numword when chording it with Typo
|
||||
case NUMWORD: // For the combo NUMWORD to work
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -14,24 +14,24 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "typo_layer.h"
|
||||
#include "odk_layer.h"
|
||||
|
||||
static uint16_t typo_keycode = KC_NO;
|
||||
//bool exit_typo = false;
|
||||
static uint16_t odk_keycode = KC_NO;
|
||||
//bool exit_odk = false;
|
||||
|
||||
bool process_typo_layer(uint16_t keycode, keyrecord_t *record) {
|
||||
bool process_odk_layer(uint16_t keycode, keyrecord_t *record) {
|
||||
|
||||
if (record->event.pressed) { // On press
|
||||
|
||||
const uint8_t mods = get_mods() | get_weak_mods() | get_oneshot_mods();
|
||||
static bool is_shifted = false;
|
||||
|
||||
if (keycode == OS_TYPO) {
|
||||
if (keycode == OS_ODK) {
|
||||
// Handle the custom OSL that go with this feature
|
||||
// It's timerless, to avoid problems when rolling with an other key, when shift is on.
|
||||
// Custom behaviour when alt-gr
|
||||
if (mods & MOD_BIT(KC_ALGR)) {
|
||||
tap_code16(ALGR(FG_TYPO));
|
||||
tap_code16(ALGR(FG_ODK));
|
||||
return false;
|
||||
}
|
||||
is_shifted = mods & MOD_MASK_SHIFT;
|
||||
|
|
@ -40,12 +40,12 @@ bool process_typo_layer(uint16_t keycode, keyrecord_t *record) {
|
|||
del_oneshot_mods(MOD_MASK_SHIFT);
|
||||
unregister_mods(MOD_MASK_SHIFT);
|
||||
}
|
||||
layer_on(_TYPO);
|
||||
typo_keycode = KC_NO;
|
||||
layer_on(_ODK);
|
||||
odk_keycode = KC_NO;
|
||||
return false;
|
||||
|
||||
} else if (keycode == FG_TYPO) {
|
||||
// Special behaviour of FR_TYPO when shifted
|
||||
} else if (keycode == FG_ODK) {
|
||||
// Special behaviour of FR_ODK when shifted
|
||||
// Shift must apply to the next keycode
|
||||
/* is_shifted = mods & MOD_MASK_SHIFT;
|
||||
if (is_shifted) {
|
||||
|
|
@ -53,12 +53,12 @@ bool process_typo_layer(uint16_t keycode, keyrecord_t *record) {
|
|||
del_oneshot_mods(MOD_MASK_SHIFT);
|
||||
unregister_mods(MOD_MASK_SHIFT);
|
||||
} */
|
||||
//tap_code(FR_TYPO);
|
||||
//tap_code(FR_ODK);
|
||||
return true;
|
||||
|
||||
} else if (IS_LAYER_ON(_TYPO)) {
|
||||
if (typo_keycode == KC_NO) { typo_keycode = keycode; }
|
||||
//if (!IS_QK_USER(keycode)) { typo_keycode = keycode; }
|
||||
} else if (IS_LAYER_ON(_ODK)) {
|
||||
if (odk_keycode == KC_NO) { odk_keycode = keycode; }
|
||||
//if (!IS_QK_USER(keycode)) { odk_keycode = keycode; }
|
||||
|
||||
switch (keycode) {
|
||||
case FG_AROB:
|
||||
|
|
@ -70,7 +70,7 @@ bool process_typo_layer(uint16_t keycode, keyrecord_t *record) {
|
|||
case AGRV_SPC:
|
||||
case KC_SPC: // When space is added by Clever Keys
|
||||
case FG_3PTS:
|
||||
case CNL_TYPO:
|
||||
case CNL_ODK:
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
@ -80,7 +80,7 @@ bool process_typo_layer(uint16_t keycode, keyrecord_t *record) {
|
|||
del_oneshot_mods(MOD_MASK_SHIFT);
|
||||
unregister_mods(MOD_MASK_SHIFT);
|
||||
} */
|
||||
tap_code(FG_TYPO);
|
||||
tap_code(FG_ODK);
|
||||
}
|
||||
if (!IS_LAYER_ON(_APOS_DR)) {
|
||||
switch (keycode) {
|
||||
|
|
@ -94,29 +94,29 @@ bool process_typo_layer(uint16_t keycode, keyrecord_t *record) {
|
|||
set_oneshot_mods(MOD_BIT(KC_LSFT));
|
||||
is_shifted = false;
|
||||
}
|
||||
//exit_typo = true;
|
||||
//exit_odk = true;
|
||||
} else {
|
||||
typo_keycode = KC_NO;
|
||||
odk_keycode = KC_NO;
|
||||
}
|
||||
} else { // On release
|
||||
switch (keycode) {
|
||||
case OS_TYPO:
|
||||
case FG_TYPO:
|
||||
case OS_ODK:
|
||||
case FG_ODK:
|
||||
break;
|
||||
default:
|
||||
//if (exit_typo) { typo_layer_off(); }
|
||||
if (keycode == typo_keycode) {
|
||||
layer_off(_TYPO);
|
||||
typo_keycode = KC_NO;
|
||||
//if (exit_odk) { odk_layer_off(); }
|
||||
if (keycode == odk_keycode) {
|
||||
layer_off(_ODK);
|
||||
odk_keycode = KC_NO;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void typo_layer_off(uint16_t keycode) {
|
||||
if (keycode == typo_keycode) {
|
||||
layer_off(_TYPO);
|
||||
typo_keycode = KC_NO;
|
||||
void odk_layer_off(uint16_t keycode) {
|
||||
if (keycode == odk_keycode) {
|
||||
layer_off(_ODK);
|
||||
odk_keycode = KC_NO;
|
||||
}
|
||||
}
|
||||
|
|
@ -24,12 +24,12 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern bool exit_typo;
|
||||
extern bool exit_odk;
|
||||
|
||||
void typo_layer_off(uint16_t keycode);
|
||||
void odk_layer_off(uint16_t keycode);
|
||||
|
||||
//bool update_oneshot_typo(oneshot_state *state, uint16_t keycode, keyrecord_t *record);
|
||||
bool process_typo_layer(uint16_t keycode, keyrecord_t *record);
|
||||
//bool update_oneshot_odk(oneshot_state *state, uint16_t keycode, keyrecord_t *record);
|
||||
bool process_odk_layer(uint16_t keycode, keyrecord_t *record);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
@ -1,167 +0,0 @@
|
|||
/* Copyright 2025 @Kawamashi
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "typo_layer.h"
|
||||
//#include "print.h"
|
||||
|
||||
oneshot_state os_typo_state = os_up_unqueued;
|
||||
static bool is_shifted = false;
|
||||
//static uint16_t typo_keycode = KC_NO;
|
||||
//bool exit_typo = false;
|
||||
|
||||
bool update_oneshot_typo(oneshot_state *state, uint16_t keycode, keyrecord_t *record) {
|
||||
|
||||
const uint8_t mods = get_mods() | get_weak_mods() | get_oneshot_mods();
|
||||
|
||||
if (keycode == OS_TYPO) {
|
||||
// Handle the custom OSL that go with this feature
|
||||
// It's timerless, to avoid problems when rolling with an other key, when shift is on.
|
||||
if (record->event.pressed) { // On press
|
||||
// Custom behaviour when alt-gr
|
||||
if (mods & MOD_BIT(KC_ALGR)) {
|
||||
tap_code16(ALGR(FG_TYPO));
|
||||
return false;
|
||||
}
|
||||
is_shifted = mods & MOD_MASK_SHIFT;
|
||||
if (is_shifted) {
|
||||
del_weak_mods(MOD_MASK_SHIFT);
|
||||
del_oneshot_mods(MOD_MASK_SHIFT);
|
||||
unregister_mods(MOD_MASK_SHIFT);
|
||||
}
|
||||
layer_on(_TYPO);
|
||||
//*state = os_down_unused;
|
||||
*state = os_up_queued;
|
||||
return false;
|
||||
} else { // On release
|
||||
return true;
|
||||
}
|
||||
|
||||
//} else if (keycode == CNL_TYPO) {
|
||||
|
||||
|
||||
} else if (keycode == FG_TYPO) {
|
||||
// Special behaviour of FR_TYPO when shifted
|
||||
// Shift must apply to the next keycode
|
||||
/* is_shifted = mods & MOD_MASK_SHIFT;
|
||||
if (is_shifted) {
|
||||
del_weak_mods(MOD_MASK_SHIFT);
|
||||
del_oneshot_mods(MOD_MASK_SHIFT);
|
||||
unregister_mods(MOD_MASK_SHIFT);
|
||||
} */
|
||||
//tap_code(FR_TYPO);
|
||||
*state = os_up_queued;
|
||||
return true;
|
||||
|
||||
} else {
|
||||
if (record->event.pressed) {
|
||||
uint8_t key_layer = read_source_layers_cache(record->event.key);
|
||||
if (key_layer == _TYPO) {
|
||||
// On non-ignored keyup, consider the oneshot used.
|
||||
switch (*state) {
|
||||
/* case os_down_unused:
|
||||
*state = os_down_used;
|
||||
dprintf("key down, layer: %d, os_down_unused -> os_down_used\n", _TYPO);
|
||||
return true; */
|
||||
case os_up_queued:
|
||||
*state = os_up_queued_used;
|
||||
dprintf("key down, layer: %d, os_up_queued -> os_up_queued_used\n", _TYPO);
|
||||
return true;
|
||||
case os_up_queued_used:
|
||||
*state = os_up_unqueued;
|
||||
layer_off(_TYPO);
|
||||
dprintf("key down (off), layer: %d, os_up_queued_used -> os_up_unqueued\n", _TYPO);
|
||||
//return false;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Ignore key ups from other layers
|
||||
uint8_t key_layer = read_source_layers_cache(record->event.key);
|
||||
if (key_layer == _TYPO) {
|
||||
// On non-ignored keyup, consider the oneshot used.
|
||||
switch (*state) {
|
||||
case os_up_queued:
|
||||
*state = os_up_unqueued;
|
||||
layer_off(_TYPO);
|
||||
dprintf("key up (off), layer: %d, os_up_queued -> os_up_unqueued\n", _TYPO);
|
||||
return true;
|
||||
case os_up_queued_used:
|
||||
*state = os_up_unqueued;
|
||||
layer_off(_TYPO);
|
||||
dprintf("key up (off), layer: %d, os_up_queued_used -> os_up_unqueued\n", _TYPO);
|
||||
return true;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool process_typo_layer(uint16_t keycode, keyrecord_t *record) {
|
||||
|
||||
//if (keycode == FG_TYPO) { return true; }
|
||||
|
||||
if (!update_oneshot_typo(&os_typo_state, keycode, record)) { return false; }
|
||||
|
||||
|
||||
if (IS_LAYER_ON(_TYPO)) {
|
||||
if (record->event.pressed) { // On press
|
||||
|
||||
switch (keycode) {
|
||||
case FG_AROB:
|
||||
case FG_K:
|
||||
case FG_J:
|
||||
case OU_GRV:
|
||||
case FG_CCED:
|
||||
case AGRV_SPC:
|
||||
case KC_SPC: // When space is added by Clever Keys
|
||||
case CNL_TYPO:
|
||||
break;
|
||||
|
||||
default:
|
||||
/* is_shifted = mods & MOD_MASK_SHIFT;
|
||||
if (is_shifted) {
|
||||
del_weak_mods(MOD_MASK_SHIFT);
|
||||
del_oneshot_mods(MOD_MASK_SHIFT);
|
||||
unregister_mods(MOD_MASK_SHIFT);
|
||||
} */
|
||||
tap_code(FG_TYPO);
|
||||
}
|
||||
if (!IS_LAYER_ON(_APOS_DR)) {
|
||||
switch (keycode) {
|
||||
case FG_M:
|
||||
case FG_L:
|
||||
is_shifted = true;
|
||||
}
|
||||
}
|
||||
if (is_shifted) {
|
||||
//set_mods(mods);
|
||||
set_oneshot_mods(MOD_BIT(KC_LSFT));
|
||||
is_shifted = false;
|
||||
}
|
||||
//exit_typo = true;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/* void typo_layer_off(void) {
|
||||
layer_off(_TYPO);
|
||||
exit_typo = false;
|
||||
} */
|
||||
|
|
@ -1,165 +0,0 @@
|
|||
/* Copyright 2025 @Kawamashi
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "typo_layer.h"
|
||||
//#include "print.h"
|
||||
|
||||
oneshot_state os_typo_state = os_up_unqueued;
|
||||
static bool is_shifted = false;
|
||||
//static uint16_t typo_keycode = KC_NO;
|
||||
//bool exit_typo = false;
|
||||
|
||||
bool update_oneshot_typo(oneshot_state *state, uint16_t keycode, keyrecord_t *record) {
|
||||
|
||||
const uint8_t mods = get_mods() | get_weak_mods() | get_oneshot_mods();
|
||||
|
||||
if (keycode == OS_TYPO) {
|
||||
// Handle the custom OSL that go with this feature
|
||||
// It's timerless, to avoid problems when rolling with an other key, when shift is on.
|
||||
if (record->event.pressed) { // On press
|
||||
// Custom behaviour when alt-gr
|
||||
if (mods & MOD_BIT(KC_ALGR)) {
|
||||
tap_code16(ALGR(FG_TYPO));
|
||||
return false;
|
||||
}
|
||||
is_shifted = mods & MOD_MASK_SHIFT;
|
||||
if (is_shifted) {
|
||||
del_weak_mods(MOD_MASK_SHIFT);
|
||||
del_oneshot_mods(MOD_MASK_SHIFT);
|
||||
unregister_mods(MOD_MASK_SHIFT);
|
||||
}
|
||||
layer_on(_TYPO);
|
||||
//*state = os_down_unused;
|
||||
*state = os_up_queued;
|
||||
return false;
|
||||
} else { // On release
|
||||
return true;
|
||||
}
|
||||
|
||||
//} else if (keycode == CNL_TYPO) {
|
||||
|
||||
|
||||
} else if (keycode == FG_TYPO) {
|
||||
// Special behaviour of FR_TYPO when shifted
|
||||
// Shift must apply to the next keycode
|
||||
/* is_shifted = mods & MOD_MASK_SHIFT;
|
||||
if (is_shifted) {
|
||||
del_weak_mods(MOD_MASK_SHIFT);
|
||||
del_oneshot_mods(MOD_MASK_SHIFT);
|
||||
unregister_mods(MOD_MASK_SHIFT);
|
||||
} */
|
||||
//tap_code(FR_TYPO);
|
||||
//*state = os_up_queued;
|
||||
return true;
|
||||
|
||||
} else {
|
||||
if (record->event.pressed) {
|
||||
//uint8_t key_layer = read_source_layers_cache(record->event.key);
|
||||
//if (key_layer == _TYPO) {
|
||||
if (IS_LAYER_ON(_TYPO)) {
|
||||
// On non-ignored keyup, consider the oneshot used.
|
||||
switch (*state) {
|
||||
/* case os_down_unused:
|
||||
*state = os_down_used;
|
||||
dprintf("key down, layer: %d, os_down_unused -> os_down_used\n", _TYPO);
|
||||
return true; */
|
||||
case os_up_queued:
|
||||
*state = os_up_queued_used;
|
||||
return true;
|
||||
case os_up_queued_used:
|
||||
*state = os_up_unqueued;
|
||||
layer_off(_TYPO);
|
||||
//return false;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Ignore key ups from other layers
|
||||
//uint8_t key_layer = read_source_layers_cache(record->event.key);
|
||||
//if (key_layer == _TYPO) {
|
||||
if (IS_LAYER_ON(_TYPO)) {
|
||||
// On non-ignored keyup, consider the oneshot used.
|
||||
switch (*state) {
|
||||
case os_up_queued:
|
||||
*state = os_up_unqueued;
|
||||
layer_off(_TYPO);
|
||||
return true;
|
||||
case os_up_queued_used:
|
||||
*state = os_up_unqueued;
|
||||
layer_off(_TYPO);
|
||||
return true;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool process_typo_layer(uint16_t keycode, keyrecord_t *record) {
|
||||
|
||||
//if (keycode == FG_TYPO) { return true; }
|
||||
|
||||
if (!update_oneshot_typo(&os_typo_state, keycode, record)) { return false; }
|
||||
|
||||
|
||||
if (IS_LAYER_ON(_TYPO)) {
|
||||
if (record->event.pressed) { // On press
|
||||
|
||||
switch (keycode) {
|
||||
case FG_AROB:
|
||||
case FG_K:
|
||||
case FG_J:
|
||||
case OU_GRV:
|
||||
case FG_CCED:
|
||||
case AGRV_SPC:
|
||||
case KC_SPC: // When space is added by Clever Keys
|
||||
case CNL_TYPO:
|
||||
break;
|
||||
|
||||
default:
|
||||
/* is_shifted = mods & MOD_MASK_SHIFT;
|
||||
if (is_shifted) {
|
||||
del_weak_mods(MOD_MASK_SHIFT);
|
||||
del_oneshot_mods(MOD_MASK_SHIFT);
|
||||
unregister_mods(MOD_MASK_SHIFT);
|
||||
} */
|
||||
tap_code(FG_TYPO);
|
||||
}
|
||||
if (!IS_LAYER_ON(_APOS_DR)) {
|
||||
switch (keycode) {
|
||||
case FG_M:
|
||||
case FG_L:
|
||||
is_shifted = true;
|
||||
}
|
||||
}
|
||||
if (is_shifted) {
|
||||
//set_mods(mods);
|
||||
set_oneshot_mods(MOD_BIT(KC_LSFT));
|
||||
is_shifted = false;
|
||||
}
|
||||
//exit_typo = true;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/* void typo_layer_off(void) {
|
||||
layer_off(_TYPO);
|
||||
exit_typo = false;
|
||||
} */
|
||||
|
|
@ -1,124 +0,0 @@
|
|||
/* Copyright 2025 @Kawamashi
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "typo_layer.h"
|
||||
|
||||
static uint16_t typo_keycode = KC_NO;
|
||||
//bool exit_typo = false;
|
||||
|
||||
bool process_typo(uint16_t keycode, keyrecord_t *record) {
|
||||
|
||||
if (record->event.pressed) { // On press
|
||||
|
||||
const uint8_t mods = get_mods() | get_weak_mods() | get_oneshot_mods();
|
||||
static bool is_shifted = false;
|
||||
|
||||
if (keycode == OS_TYPO) {
|
||||
// Handle the custom OSL that go with this feature
|
||||
// It's timerless, to avoid problems when rolling with an other key, when shift is on.
|
||||
// Custom behaviour when alt-gr
|
||||
if (mods & MOD_BIT(KC_ALGR)) {
|
||||
tap_code16(ALGR(FG_TYPO));
|
||||
return false;
|
||||
}
|
||||
is_shifted = mods & MOD_MASK_SHIFT;
|
||||
if (is_shifted) {
|
||||
del_weak_mods(MOD_MASK_SHIFT);
|
||||
del_oneshot_mods(MOD_MASK_SHIFT);
|
||||
unregister_mods(MOD_MASK_SHIFT);
|
||||
}
|
||||
layer_on(_TYPO);
|
||||
return false;
|
||||
|
||||
} else if (keycode == FG_TYPO) {
|
||||
// Special behaviour of FR_TYPO when shifted
|
||||
// Shift must apply to the next keycode
|
||||
/* is_shifted = mods & MOD_MASK_SHIFT;
|
||||
if (is_shifted) {
|
||||
del_weak_mods(MOD_MASK_SHIFT);
|
||||
del_oneshot_mods(MOD_MASK_SHIFT);
|
||||
unregister_mods(MOD_MASK_SHIFT);
|
||||
} */
|
||||
//tap_code(FR_TYPO);
|
||||
return true;
|
||||
|
||||
} else if (IS_LAYER_ON(_TYPO)) {
|
||||
if (typo_keycode == KC_NO) {
|
||||
typo_keycode = keycode;
|
||||
//if (!IS_QK_USER(keycode)) { typo_keycode = keycode; }
|
||||
} else {
|
||||
// if another key is tapped when the 1st one is not released yet.
|
||||
layer_off(_TYPO);
|
||||
//typo_keycode = KC_NO;
|
||||
return true;
|
||||
}
|
||||
|
||||
switch (keycode) {
|
||||
case FG_AROB:
|
||||
case FG_K:
|
||||
case FG_J:
|
||||
case OU_GRV:
|
||||
case FG_CCED:
|
||||
case AGRV_SPC:
|
||||
case KC_SPC: // When space is added by Clever Keys
|
||||
case CNL_TYPO:
|
||||
break;
|
||||
|
||||
default:
|
||||
/* is_shifted = mods & MOD_MASK_SHIFT;
|
||||
if (is_shifted) {
|
||||
del_weak_mods(MOD_MASK_SHIFT);
|
||||
del_oneshot_mods(MOD_MASK_SHIFT);
|
||||
unregister_mods(MOD_MASK_SHIFT);
|
||||
} */
|
||||
tap_code(FG_TYPO);
|
||||
}
|
||||
if (!IS_LAYER_ON(_APOS_DR)) {
|
||||
switch (keycode) {
|
||||
case FG_M:
|
||||
case FG_L:
|
||||
is_shifted = true;
|
||||
}
|
||||
}
|
||||
if (is_shifted) {
|
||||
//set_mods(mods);
|
||||
set_oneshot_mods(MOD_BIT(KC_LSFT));
|
||||
is_shifted = false;
|
||||
}
|
||||
//exit_typo = true;
|
||||
} else {
|
||||
typo_keycode = KC_NO;
|
||||
}
|
||||
} else { // On release
|
||||
switch (keycode) {
|
||||
case OS_TYPO:
|
||||
case FG_TYPO:
|
||||
break;
|
||||
default:
|
||||
//if (exit_typo) { typo_layer_off(); }
|
||||
if (keycode == typo_keycode) {
|
||||
layer_off(_TYPO);
|
||||
typo_keycode = KC_NO;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/* void typo_layer_off(void) {
|
||||
layer_off(_TYPO);
|
||||
exit_typo = false;
|
||||
} */
|
||||
|
|
@ -74,7 +74,7 @@ bool caps_word_press_user(uint16_t keycode) {
|
|||
}
|
||||
}
|
||||
|
||||
if (IS_LAYER_ON(_TYPO)) {
|
||||
if (IS_LAYER_ON(_ODK)) {
|
||||
switch (keycode) {
|
||||
case FG_VIRG:
|
||||
add_weak_mods(MOD_BIT(KC_LSFT)); // Apply shift to next key.
|
||||
|
|
@ -105,7 +105,7 @@ bool caps_word_press_user(uint16_t keycode) {
|
|||
|
||||
switch (keycode) {
|
||||
// Keycodes that continue Caps Word, without shifting.
|
||||
case FG_TYPO:
|
||||
case FG_ODK:
|
||||
//case FG_GRV:
|
||||
case FG_MOIN:
|
||||
case KC_KP_1 ... KC_KP_0:
|
||||
|
|
@ -174,11 +174,11 @@ bool is_oneshot_ignored_key(uint16_t keycode) {
|
|||
// Autrement, la touche typo est ignorée par les Callum mods.
|
||||
// Ç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();
|
||||
//if (keycode == OS_TYPO && (mods & ~(MOD_MASK_SHIFT | MOD_BIT(KC_ALGR)))) { return true;}
|
||||
//if (keycode == OS_TYPO && (mods & ~MOD_BIT(KC_ALGR))) { return true;}
|
||||
//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;}
|
||||
|
||||
switch (keycode) {
|
||||
//case OS_TYPO: /!\ A ne pas remettre, sous peine de ne pas pouvoir faire shift + typo + touche de l'autre côté
|
||||
//case OS_ODK: /!\ A ne pas remettre, sous peine de ne pas pouvoir faire shift + typo + touche de l'autre côté
|
||||
case L_OS4A:
|
||||
case R_OS4A:
|
||||
case OS_SHFT:
|
||||
|
|
@ -189,7 +189,7 @@ bool is_oneshot_ignored_key(uint16_t keycode) {
|
|||
case OS_FA:
|
||||
case NUMWORD:
|
||||
case TT_FA:
|
||||
case FG_TYPO:
|
||||
case FG_ODK:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ bool get_hold_on_other_key_press(uint16_t keycode, keyrecord_t *record) {
|
|||
|
||||
// La ligne suivante n'est nécessaire que si on a besoin de doubler rapidement un caractère présent sur la moitié droite du clavier.
|
||||
// Ce n'est pas nécessaire pour l'instant, vu que les guillemets sont passés à gauche.
|
||||
//if (keycode == OS_TYPO) { return true; }
|
||||
//if (keycode == OS_ODK) { return true; }
|
||||
|
||||
if (forbidden_chord(keycode, record, next_keycode, &next_record)) {
|
||||
// When a layer-tap key overlaps with another key on the same hand, send its base keycode.
|
||||
|
|
@ -101,7 +101,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
|||
if (!process_macros(keycode, record)) { return false; }
|
||||
|
||||
// Custom behaviour of the typo dead-key
|
||||
if (!process_typo_layer(keycode, record)) { return false; }
|
||||
if (!process_odk_layer(keycode, record)) { return false; }
|
||||
|
||||
// Clever keys
|
||||
if (!process_clever_keys(keycode, record)) { return false; }
|
||||
|
|
@ -114,7 +114,7 @@ void post_process_record_user(uint16_t keycode, keyrecord_t* record) {
|
|||
|
||||
if (os4a_layer != 0 && exit_os4a_layer) { os4a_layer_off(os4a_layer); }
|
||||
if (exit_num_word) { disable_num_word(); }
|
||||
typo_layer_off(keycode);
|
||||
odk_layer_off(keycode);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -138,7 +138,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||
[_BASE] = LAYOUT(
|
||||
KC_NO, FG_X, FG_VIRG, FG_EACU, FG_P, FG_B, FG_F, FG_M, FG_L, FG_APOS, FG_POIN, KC_NO,
|
||||
KC_NO, FG_O, FG_A, FG_I, FG_T, FG_G, FG_V, FG_S, FG_N, FG_R, FG_U, KC_NO,
|
||||
KC_NO, FG_Q, FG_Z, FG_Y, FG_D, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, FG_C, FG_H, FG_W, OS_TYPO, KC_NO,
|
||||
KC_NO, FG_Q, FG_Z, FG_Y, FG_D, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, FG_C, FG_H, FG_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
|
||||
),
|
||||
|
||||
|
|
@ -199,7 +199,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||
*/
|
||||
[_R_MODS] = LAYOUT(
|
||||
_______, _______, _______, _______, _______, _______, KC_NO, KC_RGUI, OS_WIN, TG_APOD, KC_NO, KC_NO,
|
||||
_______, _______, _______, _______, _______, _______, TT_FA, OS_SHFT, OS_CTRL, NUMWORD, FG_TYPO, 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
|
||||
),
|
||||
|
|
@ -223,7 +223,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||
[_NUMBERS] = LAYOUT(
|
||||
_______, _______, 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_8, _______, _______, _______, _______, _______, _______, KC_9, KC_6, _______, FG_TYPO, _______,
|
||||
_______, _______, _______, _______, KC_8, _______, _______, _______, _______, _______, _______, KC_9, KC_6, _______, FG_ODK, _______,
|
||||
_______, _______, KC_PDOT, KC_0 , NUMWORD, LT_REPT, KC_SPC, _______, _______, _______
|
||||
),
|
||||
|
||||
|
|
@ -242,10 +242,10 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||
* | | | | | | | , | | | | |
|
||||
* `----------------------------------' `----------------------------------'
|
||||
*/
|
||||
[_TYPO] = LAYOUT(
|
||||
[_ODK] = LAYOUT(
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
|
||||
_______, OU_GRV, _______, _______, FG_3PTS, _______, _______, FG_J, FG_D, FG_AROB, _______, _______,
|
||||
_______, _______, _______, _______, FG_F, _______, _______, _______, _______, _______, _______, FG_CCED, _______, FG_K, CNL_TYPO, _______,
|
||||
_______, _______, _______, _______, FG_F, _______, _______, _______, _______, _______, _______, FG_CCED, _______, FG_K, CNL_ODK, _______,
|
||||
_______, _______, _______, _______, FG_ECIR, _______, AGRV_SPC, _______, _______, _______
|
||||
),
|
||||
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@
|
|||
#include "features/macros.h"
|
||||
#include "features/os4a.h"
|
||||
#include "features/oneshot.h"
|
||||
#include "features/typo_layer.h"
|
||||
#include "features/odk_layer.h"
|
||||
|
||||
|
||||
enum layers {
|
||||
|
|
@ -36,7 +36,7 @@ enum layers {
|
|||
// OS4A layers should be as closed as base layer as possible
|
||||
_L_MODS,
|
||||
_R_MODS,
|
||||
_TYPO,
|
||||
_ODK,
|
||||
_NUMBERS,
|
||||
_SHORTNAV,
|
||||
_FUNCAPPS,
|
||||
|
|
@ -68,8 +68,8 @@ enum custom_keycodes {
|
|||
OS_RALT,
|
||||
OS_LALT,
|
||||
OS_WIN,
|
||||
OS_TYPO,
|
||||
CNL_TYPO
|
||||
OS_ODK,
|
||||
CNL_ODK
|
||||
};
|
||||
|
||||
// Layer taps
|
||||
|
|
@ -83,7 +83,7 @@ enum custom_keycodes {
|
|||
#define MT_SLSH SFT_T(FG_SLSH)
|
||||
#define MT_1 SFT_T(KC_1)
|
||||
#define E_CIRC S(FG_0)
|
||||
//#define OS_TYPO OSL(_TYPO)
|
||||
//#define OS_ODK OSL(_ODK)
|
||||
|
||||
// One shot mods
|
||||
#define L_OS4A LSFT_T(OS4A)
|
||||
|
|
|
|||
|
|
@ -90,7 +90,7 @@
|
|||
#define FG_C KC_M // C
|
||||
#define FG_H KC_COMM // H
|
||||
#define FG_W KC_DOT // W
|
||||
#define FG_TYPO KC_SLSH // **
|
||||
#define FG_ODK KC_SLSH // **
|
||||
|
||||
|
||||
/* Shifted symbols
|
||||
|
|
@ -118,7 +118,7 @@
|
|||
|
||||
|
||||
// Row 4
|
||||
//#define FG_PVIR S(FG_TYPO)
|
||||
//#define FG_PVIR S(FG_ODK)
|
||||
|
||||
// Row 5
|
||||
#define FG_NBSP S(KC_SPC) // Espace insecable
|
||||
|
|
@ -178,7 +178,7 @@
|
|||
#define FG_LCBR ALGR(FG_C) // {
|
||||
#define FG_RCBR ALGR(FG_H) // }
|
||||
#define FG_LSBR ALGR(FG_W) // [
|
||||
#define FG_RSBR ALGR(FG_TYPO) // ]
|
||||
#define FG_RSBR ALGR(FG_ODK) // ]
|
||||
|
||||
|
||||
/* Shift+AltGr symbols
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ bool oled_task_user(void) {
|
|||
case _FUNCAPPS:
|
||||
oled_write_P(PSTR("FuncApps\n"), false);
|
||||
break;
|
||||
case _TYPO:
|
||||
case _ODK:
|
||||
oled_write_P(PSTR("Accents\n"), false);
|
||||
break;
|
||||
default:
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ SRC += features/numword.c
|
|||
SRC += features/macros.c
|
||||
SRC += features/oneshot.c
|
||||
SRC += features_conf.c
|
||||
SRC += features/typo_layer.c
|
||||
SRC += features/odk_layer.c
|
||||
|
||||
INTROSPECTION_KEYMAP_C = features/combos.c
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue