make TapDance a module (#281)

* extract tapdance logic into a module

* clean out old tapdance code

* canonicalize key variable names

* split _process_tap_dance into td_pressed and td_released

* implement consistent argument order

* update documentation

* implement Module.process_key for key interception and modification

* fix tapdance realesing instead of pressing

* fix: default parameters in key handler

* cleanup holdtap

* add error handling to modules process_key

* fix: key released too late

Tapped keys didn't release on a "key released" event, but waited for a
timeout. Resulted in, for example, modifiers applying to keys after the
modifier was released.

* fix lint/formatting

* fix tap_time reference in modtap + minimal documentation

* fix lint
This commit is contained in:
xs5871
2022-01-18 05:21:05 +00:00
committed by GitHub
parent 10f8c74ad9
commit a62d39a252
9 changed files with 169 additions and 133 deletions

View File

@@ -105,14 +105,6 @@ def uc_mode_pressed(key, keyboard, *args, **kwargs):
return keyboard
def td_pressed(key, keyboard, *args, **kwargs):
return keyboard._process_tap_dance(key, True)
def td_released(key, keyboard, *args, **kwargs):
return keyboard._process_tap_dance(key, False)
def hid_switch(key, keyboard, *args, **kwargs):
keyboard.hid_type, keyboard.secondary_hid_type = (
keyboard.secondary_hid_type,