2023-06-26 01:29:50 -08:00
|
|
|
import type {BrowserWindow, MenuItemConstructorOptions} from 'electron';
|
2019-12-20 08:55:03 -09:00
|
|
|
|
2023-07-25 08:11:02 -08:00
|
|
|
const toolsMenu = (
|
2019-12-20 08:55:03 -09:00
|
|
|
commands: Record<string, string>,
|
|
|
|
|
execCommand: (command: string, focusedWindow?: BrowserWindow) => void
|
|
|
|
|
): MenuItemConstructorOptions => {
|
2017-05-25 22:59:02 -08:00
|
|
|
return {
|
2021-01-22 00:35:26 -09:00
|
|
|
label: 'Tools',
|
2017-05-25 22:59:02 -08:00
|
|
|
submenu: [
|
|
|
|
|
{
|
2021-01-22 00:35:26 -09:00
|
|
|
label: 'Update plugins',
|
2017-06-02 16:03:47 -08:00
|
|
|
accelerator: commands['plugins:update'],
|
2017-05-25 22:59:02 -08:00
|
|
|
click() {
|
2018-04-22 12:13:23 -08:00
|
|
|
execCommand('plugins:update');
|
2017-05-25 22:59:02 -08:00
|
|
|
}
|
2018-04-22 12:13:23 -08:00
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
label: 'Install Hyper CLI command in PATH',
|
|
|
|
|
click() {
|
|
|
|
|
execCommand('cli:install');
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
type: 'separator'
|
2021-01-24 07:44:04 -09:00
|
|
|
},
|
|
|
|
|
...(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'
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
: [])
|
2017-05-25 22:59:02 -08:00
|
|
|
]
|
|
|
|
|
};
|
|
|
|
|
};
|
2023-07-25 08:11:02 -08:00
|
|
|
|
|
|
|
|
export default toolsMenu;
|