mirror of
https://github.com/quine-global/hyper.git
synced 2026-01-14 04:48:40 -09:00
47 lines
1.1 KiB
TypeScript
47 lines
1.1 KiB
TypeScript
import {BrowserWindow, MenuItemConstructorOptions} from 'electron';
|
|
|
|
export default (
|
|
commands: Record<string, string>,
|
|
execCommand: (command: string, focusedWindow?: BrowserWindow) => void
|
|
): MenuItemConstructorOptions => {
|
|
return {
|
|
label: 'Tools',
|
|
submenu: [
|
|
{
|
|
label: 'Update plugins',
|
|
accelerator: commands['plugins:update'],
|
|
click() {
|
|
execCommand('plugins:update');
|
|
}
|
|
},
|
|
{
|
|
label: 'Install Hyper CLI command in PATH',
|
|
click() {
|
|
execCommand('cli:install');
|
|
}
|
|
},
|
|
{
|
|
type: 'separator'
|
|
},
|
|
...(process.platform === 'win32'
|
|
? <MenuItemConstructorOptions[]>[
|
|
{
|
|
label: 'Add Hyper to system context menu',
|
|
click() {
|
|
execCommand('systemContextMenu:add');
|
|
}
|
|
},
|
|
{
|
|
label: 'Remove Hyper from system context menu',
|
|
click() {
|
|
execCommand('systemContextMenu:remove');
|
|
}
|
|
},
|
|
{
|
|
type: 'separator'
|
|
}
|
|
]
|
|
: [])
|
|
]
|
|
};
|
|
};
|