Skip to content

Commit

Permalink
Delay between key map set
Browse files Browse the repository at this point in the history
Workaround for Chrome's behavior
  • Loading branch information
user202729 committed Mar 17, 2021
1 parent d7af0fe commit f4cb21c
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions plover/oslayer/xkeyboardcontrol.py
Expand Up @@ -1293,14 +1293,24 @@ def send_string(self, s):
"""
for char in s:
keysym = uchr_to_keysym(char)
mapping = self._get_mapping(keysym)
mapping = self._get_mapping(keysym, automatically_map=False)
mapping_changed = False
if mapping is None:
continue
mapping = self._get_mapping(keysym, automatically_map=True)
if mapping is None:
continue
if self._time_between_key_presses != 0:
self._display.sync()
sleep(self._time_between_key_presses / 2000)
mapping_changed = True
self._send_keycode(mapping.keycode,
mapping.modifiers)
if self._time_between_key_presses != 0:
self._display.sync()
sleep(self._time_between_key_presses / 1000)
if mapping_changed:
sleep(self._time_between_key_presses / 2000)
else:
sleep(self._time_between_key_presses / 1000)
self._display.sync()

@with_display_lock
Expand Down

0 comments on commit f4cb21c

Please sign in to comment.