a62d39a252
* 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
44 lines
1.2 KiB
Python
44 lines
1.2 KiB
Python
class InvalidExtensionEnvironment(Exception):
|
|
pass
|
|
|
|
|
|
class Module:
|
|
'''
|
|
Modules differ from extensions in that they not only can read the state, but
|
|
are allowed to modify the state. The will be loaded on boot, and are not
|
|
allowed to be unloaded as they are required to continue functioning in a
|
|
consistant manner.
|
|
'''
|
|
|
|
# The below methods should be implemented by subclasses
|
|
|
|
def during_bootup(self, keyboard):
|
|
raise NotImplementedError
|
|
|
|
def before_matrix_scan(self, keyboard):
|
|
'''
|
|
Return value will be injected as an extra matrix update
|
|
'''
|
|
raise NotImplementedError
|
|
|
|
def after_matrix_scan(self, keyboard):
|
|
'''
|
|
Return value will be replace matrix update if supplied
|
|
'''
|
|
raise NotImplementedError
|
|
|
|
def before_hid_send(self, keyboard):
|
|
raise NotImplementedError
|
|
|
|
def after_hid_send(self, keyboard):
|
|
raise NotImplementedError
|
|
|
|
def on_powersave_enable(self, keyboard):
|
|
raise NotImplementedError
|
|
|
|
def on_powersave_disable(self, keyboard):
|
|
raise NotImplementedError
|
|
|
|
def process_key(self, keyboard, key, is_pressed):
|
|
return key
|