Skip to content

Commit

Permalink
Add small time delay between press and release
Browse files Browse the repository at this point in the history
Very short keypresses are sometimes coalesced and by the Desktop-System and do not reach the application, when it is not in focus. This might be the reason for various hotkey-problems when the target application is not in focus: timothycrosley#47 timothycrosley#59 timothycrosley#33
  • Loading branch information
MaZderMind authored Aug 31, 2020
1 parent ce2156a commit 1b2da54
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions streamdeck_ui/api.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""Defines the Python API for interacting with the StreamDeck Configuration UI"""
import json
import os
import time
import threading
from functools import partial
from subprocess import Popen # nosec - Need to allow users to specify arbitrary commands
Expand Down Expand Up @@ -35,6 +36,7 @@ def _key_change_callback(deck_id: str, _deck: StreamDeck.StreamDeck, key: int, s
for section in keys.split(","):
for key_name in section.split("+"):
keyboard.press(getattr(Key, key_name.lower(), key_name))
time.sleep(0.5)
for key_name in section.split("+"):
keyboard.release(getattr(Key, key_name.lower(), key_name))

Expand Down

0 comments on commit 1b2da54

Please sign in to comment.