Skip to content

Action

The action that the Command Bar should perform.

type CommandJSONAction =
| CommandJSONActionCopy
| CommandJSONActionPaste
| CommandJSONActionOpenURL
| CommandJSONActionShowFolder;

Copy Action

Copy content to the clipboard.

interface CommandJSONActionCopy {
type: 'copy';
content: unknown;
}
NameTypeDescription
typecopyThe action type
contentunknownContent to copy

Example

console.log(JSON.stringify({
action: {
type: 'copy',
content: 'Hello world!!',
}
}))

Paste Action

Paste content to the frontmost window.

interface CommandJSONActionPaste {
type: 'paste';
content: string;
}
NameTypeDescription
typecopyThe action type
contentstringContent to paste

Example

console.log(JSON.stringify({
action: {
type: 'paste',
content: 'Hello world!!',
}
}))

Open URL Action

Open URL with the desktop’s default browser.

interface CommandJSONActionOpenURL {
type: 'open-url';
url: string;
}
NameTypeDescription
typecopyThe action type
urlstringURL to open

Example

console.log(JSON.stringify({
action: {
type: 'open-url',
url: 'https://google.com',
}
}))

Show in Folder Action

Show the given file in a file manager. If possible, select the file.

interface CommandJSONActionShowFolder {
type: 'show-in-folder';
path: string;
}
NameTypeDescription
typecopyThe action type
pathstringPath to show in a file manager

Example

console.log(JSON.stringify({
action: {
type: 'show-in-folder',
path: 'D:\\document.txt',
}
}))