Skip to content

Commit

Permalink
remove for loops
Browse files Browse the repository at this point in the history
  • Loading branch information
regicidalplutophage authored Dec 11, 2024
1 parent f0dab6a commit 22c0143
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions kmk/modules/sticky_keys.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,20 +124,17 @@ def on_release(self, key, keyboard, *args, **kwargs):
key.state = _SK_RELEASED
# Key in HOLD state is handled like a regular release.
elif key.state == _SK_HOLD:
for sk in self.active_keys.copy():
keyboard.cancel_timeout(sk.timeout)
self.deactivate(keyboard, sk)
keyboard.cancel_timeout(key.timeout)
self.deactivate(keyboard, key)

def on_release_after(self, keyboard, key):
# Key is still pressed but nothing else happend: set to HOLD.
if key.state == _SK_PRESSED:
for sk in self.active_keys:
key.state = _SK_HOLD
keyboard.cancel_timeout(sk.timeout)
key.state = _SK_HOLD
keyboard.cancel_timeout(key.timeout)
# Key got released but nothing else happend: deactivate.
elif key.state == _SK_RELEASED:
for sk in self.active_keys.copy():
self.deactivate(keyboard, sk)
self.deactivate(keyboard, key)

def activate(self, keyboard, key):
if debug.enabled:
Expand Down

0 comments on commit 22c0143

Please sign in to comment.