Send a key down and key up event with optional modifier keys, optionally to a specific
application.
A 5 ms pause is inserted between the key-down and key-up events to improve
compatibility with applications that miss very fast synthetic keystrokes.
Without app, the keystroke is posted to the system, so it goes to whichever application
is frontmost. With app, it is delivered straight to that application, even if it's in the
background, without activating it. In that case the modifier keys are also pressed and
released around the key, as a real keyboard does, so applications that track modifier
key presses themselves see them held.
through the current keyboard layout (see hs.keycodes.map), or a numeric virtual key code,
which always presses the same physical key
send it to the frontmost application.
Parameters
mods: string[]
An array of modifier names (e.g. ["cmd", "shift"])
key: string|number
A key name or character (e.g. "a", "space", "return"), resolved
Send a key down and key up event with optional modifier keys, optionally to a specific application. A 5 ms pause is inserted between the key-down and key-up events to improve compatibility with applications that miss very fast synthetic keystrokes. Without
app, the keystroke is posted to the system, so it goes to whichever application is frontmost. Withapp, it is delivered straight to that application, even if it's in the background, without activating it. In that case the modifier keys are also pressed and released around the key, as a real keyboard does, so applications that track modifier key presses themselves see them held. through the current keyboard layout (seehs.keycodes.map), or a numeric virtual key code, which always presses the same physical key send it to the frontmost application.