Skip to content

Commit

Permalink
(fix) only resuspend if a key was just pressed (not repeated)
Browse files Browse the repository at this point in the history
  • Loading branch information
joshgoebel committed Jun 13, 2022
1 parent c1c3cf4 commit f8165f5
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/keyszer/transform.py
Original file line number Diff line number Diff line change
Expand Up @@ -378,15 +378,15 @@ def on_event(event, device_name):
def on_key(keystate, context):
global _last_key
hold_output = False
can_suspend = False
should_suspend = False

key, action = (keystate.key, keystate.action)
debug("on_key", key, action)

if Modifier.is_modifier(key):
if action.is_pressed():
if none_pressed():
can_suspend = True
should_suspend = True

elif action.is_released():
if is_sticky(key):
Expand All @@ -404,10 +404,13 @@ def on_key(keystate, context):
resume_keys()

update_pressed_states(keystate)
if can_suspend or is_suspended():

if should_suspend or is_suspended():
keystate.suspended = True
suspend_or_resuspend_keys()
hold_output = True
if action.just_pressed():
suspend_or_resuspend_keys()

if not hold_output:
_output.send_key_action(key, action)
elif keystate.is_multi and action.just_pressed():
Expand Down

0 comments on commit f8165f5

Please sign in to comment.