plover.oslayer.keyboardcontrol
– Keyboard control¶
This module handles platform-specific operations relating to the keyboard, both for capturing keyboard input (using the keyboard to write steno) and keyboard emulation (writing the output from steno translation).
- class plover.oslayer.keyboardcontrol.KeyboardCapture¶
Encapsulates logic for capturing keyboard input. An instance of this is used internally by Plover’s built-in keyboard plugin.
Define the
key_down()
andkey_up()
methods below to implement custom behavior that gets executed when a key is pressed or released.- SUPPORTED_KEYS_LAYOUT: str¶
A human-readable text representation of the layout of keys on the keyboard. This is the same across platforms.
- SUPPORTED_KEYS: Tuple[str]¶
A tuple containing the list of individual keys from
SUPPORTED_KEYS_LAYOUT
.
- suppress_keyboard([suppressed_keys: List[str] = ()])¶
Suppresses the specified keys, preventing them from returning any output through regular typing. This allows us to intercept keyboard events when using keyboard input.
- key_down(key: str)¶
A custom method that is called when a key is pressed.
key
is a string representing the name of the key, and must be inSUPPORTED_KEYS
. Does nothing by default.
- key_up(key: str)¶
A custom method that is called when a key is released.
key
is a string representing the name of the key, and must be inSUPPORTED_KEYS
. Does nothing by default.
- class plover.oslayer.keyboardcontrol.KeyboardEmulation¶
Encapsulates logic for sending keystrokes. Pass an instance of this to the
StenoEngine
when it is initialized.- send_backspaces(number_of_backspaces: int)¶
Sends the specified number of backspace keys.
- send_string(s: str)¶
Sends the sequence of keys that would produce the specified string.
- send_key_combination(combo_string: str)¶
Sends the specified key combination.
combo_string
is a string in the key combo format described inplover.key_combo
.