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;}
Name | Type | Description |
---|---|---|
type | copy | The action type |
content | unknown | Content 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;}
Name | Type | Description |
---|---|---|
type | copy | The action type |
content | string | Content 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;}
Name | Type | Description |
---|---|---|
type | copy | The action type |
url | string | URL 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;}
Name | Type | Description |
---|---|---|
type | copy | The action type |
path | string | Path to show in a file manager |
Example
console.log(JSON.stringify({ action: { type: 'show-in-folder', path: 'D:\\document.txt', }}))