Skip to content

pressKey

Presses a single key using trusted keyboard input, injected by the host over CDP.

Named keys ('Enter', 'Escape', 'Tab', 'Backspace', 'Delete', the arrows) and single printable characters are supported; anything else throws rather than pressing nothing.

Import:

import { pressKey } from '@mnaoumov/obsidian-lib/mobile-trusted-input';

Signature:

function pressKey(params: PressKeyParams): Promise<void>

Parameters:

Parameter Type Description
params PressKeyParams The key to press and any modifiers to hold.

Returns: Promise<void> — A Promise that resolves once the key press has been injected.