Keyboard

Keyboard

What the keyboard and the clipboard tell the page, as they tell it: the key, the modifiers held, the shortcuts the design system recognises, what is copied and pasted. Press anything, anywhere on the page — the keyboard below lights the keys by where they sit, and learns what they write on your layout.

Writing a shortcut

A shortcut is written once with Mod, which is ⌘ on a Mac and Ctrl elsewhere. The keyboard service matches it on either, and on the physical key for a letter: ⌥ on a Mac, or a Cyrillic layout, still gives Mod+S.

// ⌘S on a Mac, Ctrl+S elsewhere.
this.app.services.keyboard.registerShortcut(this, 'Mod+S', () => this.save(), { preventDefault: true });

// Its label, as this platform writes it: « ⌘S » or « Ctrl+S ».
keyboardShortcutLabel('Mod+S');