Skip to content

PressKeyParams

Parameters for pressKey.

Import:

import type { PressKeyParams } from '@mnaoumov/obsidian-lib/desktop-trusted-input';

Signature:

export interface PressKeyParams

Properties

PropertyTypeDescription
keystringThe key to press, given as an Electron Accelerator key name — e.g. 'Enter', 'Escape', 'Tab', an arrow key, or a printable character ('a', '1').
modifiers?readonly Modifier[]The modifier keys to hold, using Obsidian's Modifier names. 'Mod' resolves per-platform (Cmd on macOS, Ctrl elsewhere).
window?WindowThe Obsidian window to press the key in: the main window or a popout. Pass the window that owns the focused target, e.g. leaf.view.containerEl.win for a popout leaf. Each Obsidian window is its own Electron web contents, so the key goes to the DOM-focused element of the window named here, whichever window the OS has focused, and never reaches another window.

**On mobile** there are no popouts, so any window but the main one throws.

Links to this page: