fix(caps-mod): fix errant modifier taps and dummy keypress for combos #10
@@ -117,3 +117,4 @@ via*.json
|
||||
/.claude_session
|
||||
/.remember/tmp/save-session.pid
|
||||
/.direnv/CACHEDIR.TAG
|
||||
/.gemini_session
|
||||
|
||||
@@ -3,6 +3,16 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
// Tight, strict combo window for a simultaneous 3-key press.
|
||||
// This ensures the fallback combo only fires when intended.
|
||||
#define COMBO_TERM 10
|
||||
#define COMBO_STRICT_TIMER
|
||||
|
||||
// Use a more conservative debounce period (20ms is standard for Keychron)
|
||||
// but since we switched to 'sym_defer_pk' in rules.mk, this will now
|
||||
// require 20ms of STABILITY before a keypress is reported.
|
||||
#define DEBOUNCE 20
|
||||
|
||||
// Always resolve combo keycodes from BASE (layer 0) so the
|
||||
// COMM+DOT+SLSH fallback combo fires regardless of the active layer.
|
||||
#define COMBO_ONLY_FROM_LAYER 0
|
||||
|
||||
@@ -169,6 +169,16 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||
if (record->event.pressed) {
|
||||
caps_mod_held = true;
|
||||
caps_mod_timer = timer_read();
|
||||
// If a real modifier is held, send a dummy key so the OS sees
|
||||
// modifier+key rather than a bare modifier hold/tap. Without
|
||||
// this, the OS never receives any keycode while the modifier is
|
||||
// down and treats the eventual modifier release as a tap (e.g.
|
||||
// GUI opening the app menu). KC_F24 is harmless and universally
|
||||
// ignored by applications.
|
||||
if (get_mods() & (MOD_MASK_GUI | MOD_MASK_ALT | MOD_MASK_SHIFT)) {
|
||||
register_code(KC_F24);
|
||||
unregister_code(KC_F24);
|
||||
}
|
||||
} else {
|
||||
if (caps_mod_ctrl_registered) {
|
||||
unregister_code(KC_LCTL);
|
||||
|
||||
@@ -5,3 +5,5 @@ COMBO_ENABLE = yes
|
||||
CAPS_WORD_ENABLE = yes
|
||||
AUTOCORRECT_ENABLE = yes
|
||||
SRC += chord_unicode.c
|
||||
|
||||
DEBOUNCE_TYPE = sym_defer_pk
|
||||
|
||||
Reference in New Issue
Block a user