Skip to main content

Keybinds

set-keybinds — App → stdui

Registers a set of keyboard shortcuts. Calling this action replaces any previously registered shortcuts entirely. When a registered shortcut is triggered, stdui emits a key-pressed event.

To clear all keybinds, send an empty array.

{
"action": "set-keybinds",
"data": [
{ "id": "save", "key": "s", "ctrl": true },
{ "id": "find", "key": "f", "ctrl": true },
{ "id": "quit", "key": "q", "ctrl": true },
{ "id": "help", "key": "f1" },
{ "id": "new-item", "key": "n", "ctrl": true, "shift": true }
]
}

Fields per entry:

FieldRequiredDescription
idyesApplication-defined identifier echoed back in key-pressed
keyyesPrimary key name (case-insensitive). See Key Names below
ctrlnoRequire Ctrl (left or right). Defaults to false
shiftnoRequire Shift (left or right). Defaults to false
altnoRequire Alt (left or right). Defaults to false
metanoRequire Super / Cmd (left or right). Defaults to false

Key Names

Single characters are accepted as-is: "a""z", "0""9", "/", ",", ".", "-", "=", ";", "'", "[", "]", "\\", "`".

Named keys:

NameKey
spaceSpace bar
enter / returnEnter
tabTab
backspaceBackspace
delete / delDelete
insertInsert
escape / escEscape
leftArrow left
rightArrow right
upArrow up
downArrow down
homeHome
endEnd
pageupPage Up
pagedownPage Down
capslockCaps Lock
scrolllockScroll Lock
numlockNum Lock
printscreenPrint Screen
pausePause
f1f12Function keys

key-pressed — stdui → App

Emitted when a registered keyboard shortcut is activated.

{ "action": "key-pressed", "data": { "id": "save" } }
FieldDescription
idThe application-defined identifier from the matching set-keybinds entry