Appearance
Commands
A command is something to do from the palette, such as Add a movie. It opens one of your screens and tells it which command was chosen.
json
"commands": [
{
"id": "add",
"title": "Add a movie",
"screen": "library",
"keywords": "film new",
"keys": "Mod-Shift-m"
}
]| Key | |
|---|---|
id | The command's key. |
title | Up to 60 characters. |
screen | The screen it opens: one of your screens' id. |
keywords | Other words it's found by. |
keys | Optional shortcut. |
Shortcuts
Write a shortcut as modifiers and a key joined by -, with at least one modifier: Mod-Shift-m, Alt-F5. Mod is ⌘ on macOS and Ctrl elsewhere; Ctrl, Alt and Shift mean those keys everywhere. The key is a letter, a digit, or F1 to F12.
Sorus's own shortcuts come first: a command whose shortcut clashes with one of Sorus's never fires by it.
Handling it
js
const pages = await connect()
pages.onCommand((command) => {
if (command === 'add') openAddForm()
})A command chosen before the screen listens waits until it does, so a command that opens a fresh screen still arrives.