summaryrefslogtreecommitdiff
path: root/kvmd/plugins/hid/__init__.py
diff options
context:
space:
mode:
authorMaxim Devaev <[email protected]>2024-12-11 21:09:49 +0200
committerMaxim Devaev <[email protected]>2024-12-11 21:09:49 +0200
commite014cbcedff6d7e96a1d5d6417ed5b9362d927c5 (patch)
treeff050e6b282eb65feebb4ee5cc9d92c9f36f2796 /kvmd/plugins/hid/__init__.py
parentadbd4f242b4478dd1a67de1afb3ba799de57f2d5 (diff)
pikvm/pikvm#858, pikvm/pikvm#1249: Added slow typing mode for /api/hid/print
Diffstat (limited to 'kvmd/plugins/hid/__init__.py')
-rw-r--r--kvmd/plugins/hid/__init__.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/kvmd/plugins/hid/__init__.py b/kvmd/plugins/hid/__init__.py
index 73ff5d04..447b4d07 100644
--- a/kvmd/plugins/hid/__init__.py
+++ b/kvmd/plugins/hid/__init__.py
@@ -137,9 +137,17 @@ class BaseHid(BasePlugin): # pylint: disable=too-many-instance-attributes
# =====
- def send_key_events(self, keys: Iterable[tuple[str, bool]], no_ignore_keys: bool=False) -> None:
+ async def send_key_events(
+ self,
+ keys: Iterable[tuple[str, bool]],
+ no_ignore_keys: bool=False,
+ slow: bool=False,
+ ) -> None:
+
for (key, state) in keys:
if no_ignore_keys or key not in self.__ignore_keys:
+ if slow:
+ await asyncio.sleep(0.02)
self.send_key_event(key, state)
def send_key_event(self, key: str, state: bool) -> None: