mirror of
https://github.com/quine-global/hyper.git
synced 2026-01-13 20:38:41 -09:00
49 lines
1.2 KiB
TypeScript
49 lines
1.2 KiB
TypeScript
import type {BrowserWindow, MenuItemConstructorOptions} from 'electron';
|
|
|
|
const toolsMenu = (
|
|
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'
|
|
}
|
|
]
|
|
: [])
|
|
]
|
|
};
|
|
};
|
|
|
|
export default toolsMenu;
|