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 'obsidian-dev-utils/obsidian/mobile-trusted-input';

Signature:

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

Parameters:

ParameterTypeDescription
paramsPressKeyParamsThe key to press and any modifiers to hold.

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