From d60a9b90488a8fee8e1d827b386c1641e5395c2e Mon Sep 17 00:00:00 2001 From: Jeff Gran Date: Thu, 26 Nov 2015 00:42:42 -0700 Subject: [PATCH] enable TAPPING_TOGGLE=1 to work correctly if TAPPING_TOGGLE is 1, then tap a single time should toggle the mods on/off each tap. Previously this was broken, this fixes it. This allows the same key to either hold (momentary mod) or tap (toggle mod, like capslock). --- tmk_core/common/action.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tmk_core/common/action.c b/tmk_core/common/action.c index 1f15bd09..339b3ee6 100644 --- a/tmk_core/common/action.c +++ b/tmk_core/common/action.c @@ -131,10 +131,17 @@ void process_action(keyrecord_t *record) case MODS_TAP_TOGGLE: if (event.pressed) { if (tap_count <= TAPPING_TOGGLE) { - register_mods(mods); + if (mods & get_mods()) { + dprint("MODS_TAP_TOGGLE: toggle mods off\n"); + unregister_mods(mods); + } else { + dprint("MODS_TAP_TOGGLE: toggle mods on\n"); + register_mods(mods); + } } } else { if (tap_count < TAPPING_TOGGLE) { + dprint("MODS_TAP_TOGGLE: release : unregister_mods\n"); unregister_mods(mods); } } -- 2.39.3