mirror of
https://github.com/qmk/qmk_userspace.git
synced 2025-12-20 12:40:22 -05:00
mod_odk
This commit is contained in:
parent
fd3b08829d
commit
98abb13bd0
3 changed files with 31 additions and 16 deletions
|
|
@ -178,7 +178,7 @@ void get_clever_keycode(uint16_t* next_keycode, keyrecord_t* record) {
|
||||||
|
|
||||||
default:
|
default:
|
||||||
// "à"
|
// "à"
|
||||||
process_key(PG_ODK,record);
|
process_key(MOD_ODK, record);
|
||||||
return replace_ongoing_key(PG_A, next_keycode, record);
|
return replace_ongoing_key(PG_A, next_keycode, record);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@ bool process_odk_layer(uint16_t keycode, keyrecord_t *record) {
|
||||||
if (record->event.pressed) { // On press
|
if (record->event.pressed) { // On press
|
||||||
|
|
||||||
const uint8_t mods = get_mods() | get_weak_mods() | get_oneshot_mods();
|
const uint8_t mods = get_mods() | get_weak_mods() | get_oneshot_mods();
|
||||||
|
bool mod_odk = false;
|
||||||
//const uint8_t mods = get_mods() | get_oneshot_mods();
|
//const uint8_t mods = get_mods() | get_oneshot_mods();
|
||||||
|
|
||||||
if (keycode == OS_ODK) {
|
if (keycode == OS_ODK) {
|
||||||
|
|
@ -29,20 +30,10 @@ bool process_odk_layer(uint16_t keycode, keyrecord_t *record) {
|
||||||
tap_code16(ALGR(PG_ODK));
|
tap_code16(ALGR(PG_ODK));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
|
|
||||||
} else if (keycode == PG_ODK) {
|
} else if (keycode == MOD_ODK) {
|
||||||
// Special behaviour of PG_ODK when shifted
|
mod_odk = true;
|
||||||
// Shift must apply to the next keycode
|
|
||||||
if (mods & MOD_MASK_SHIFT) {
|
|
||||||
del_weak_mods(MOD_MASK_SHIFT);
|
|
||||||
del_oneshot_mods(MOD_MASK_SHIFT);
|
|
||||||
unregister_mods(MOD_MASK_SHIFT);
|
|
||||||
|
|
||||||
tap_code(PG_ODK);
|
|
||||||
|
|
||||||
set_oneshot_mods(MOD_BIT(KC_LSFT)); // Don't use weak mods !
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
} else if (IS_LAYER_ON(_ODK)) {
|
} else if (IS_LAYER_ON(_ODK)) {
|
||||||
switch (keycode) {
|
switch (keycode) {
|
||||||
|
|
@ -55,14 +46,37 @@ bool process_odk_layer(uint16_t keycode, keyrecord_t *record) {
|
||||||
case OU_GRV:
|
case OU_GRV:
|
||||||
case KC_SPC: // When space is added by Clever Keys
|
case KC_SPC: // When space is added by Clever Keys
|
||||||
case CNL_ODK:
|
case CNL_ODK:
|
||||||
break;
|
return true;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
mod_odk = true;
|
||||||
|
//process_odk_layer(MOD_ODK, record);
|
||||||
// Don't use tap_code, it doesn't go through process_record.
|
// Don't use tap_code, it doesn't go through process_record.
|
||||||
// therefore it doesn't trigger the special behaviour of PG_ODK described above
|
// therefore it doesn't trigger the special behaviour of PG_ODK described above
|
||||||
invoke_key(PG_ODK, record);
|
//invoke_key(PG_ODK, record);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (mod_odk) {
|
||||||
|
// Special behaviour of PG_ODK when shifted
|
||||||
|
// Shift must apply to the next keycode
|
||||||
|
mod_odk = false;
|
||||||
|
bool is_shifted = false;
|
||||||
|
|
||||||
|
if (mods & MOD_MASK_SHIFT) {
|
||||||
|
del_weak_mods(MOD_MASK_SHIFT);
|
||||||
|
del_oneshot_mods(MOD_MASK_SHIFT);
|
||||||
|
unregister_mods(MOD_MASK_SHIFT);
|
||||||
|
is_shifted = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
tap_code(PG_ODK);
|
||||||
|
|
||||||
|
if (is_shifted) {
|
||||||
|
set_oneshot_mods(MOD_BIT(KC_LSFT)); // Don't use weak mods !
|
||||||
|
}
|
||||||
|
if (keycode == MOD_ODK) { return false; }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -52,6 +52,7 @@ enum custom_keycodes {
|
||||||
OS4A,
|
OS4A,
|
||||||
RAZ,
|
RAZ,
|
||||||
CAPSWORD,
|
CAPSWORD,
|
||||||
|
MOD_ODK,
|
||||||
OU_GRV,
|
OU_GRV,
|
||||||
MAGIC,
|
MAGIC,
|
||||||
OS_SHFT,
|
OS_SHFT,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue