Initial attempt to merge internal_state with kmk_keyboard. Seems to work on Plank so far
fix formatting Example of new "Extension"/plugin system, using LED Cleanup of RGB code staticmethod to proper, normal methods Needs cleanup, but: migrate Leader to Extension API remove useless self reurns fix an AttributeError with Leader key removal Checkpoint from the weekend: split as an Extension (not working or done yet) wip
This commit is contained in:
@@ -3,21 +3,21 @@ from kmk.kmktime import ticks_diff, ticks_ms
|
||||
|
||||
def mt_pressed(key, state, *args, **kwargs):
|
||||
# Sets the timer start and acts like a modifier otherwise
|
||||
state.keys_pressed.add(key.meta.mods)
|
||||
state._keys_pressed.add(key.meta.mods)
|
||||
|
||||
state.start_time['mod_tap'] = ticks_ms()
|
||||
state._start_time['mod_tap'] = ticks_ms()
|
||||
return state
|
||||
|
||||
|
||||
def mt_released(key, state, *args, **kwargs):
|
||||
# On keyup, check timer, and press key if needed.
|
||||
state.keys_pressed.discard(key.meta.mods)
|
||||
state._keys_pressed.discard(key.meta.mods)
|
||||
timer_name = 'mod_tap'
|
||||
if state.start_time[timer_name] and (
|
||||
ticks_diff(ticks_ms(), state.start_time[timer_name]) < state.config.tap_time
|
||||
if state._start_time[timer_name] and (
|
||||
ticks_diff(ticks_ms(), state._start_time[timer_name]) < state.tap_time
|
||||
):
|
||||
state.hid_pending = True
|
||||
state.tap_key(key.meta.kc)
|
||||
state._hid_pending = True
|
||||
state._tap_key(key.meta.kc)
|
||||
|
||||
state.start_time[timer_name] = None
|
||||
state._start_time[timer_name] = None
|
||||
return state
|
||||
|
Reference in New Issue
Block a user