diff --git a/app/commands.ts b/app/commands.ts index 51abffcd..c7b01b63 100644 --- a/app/commands.ts +++ b/app/commands.ts @@ -2,6 +2,7 @@ import {app, Menu, BrowserWindow} from 'electron'; import {openConfig, getConfig} from './config'; import {updatePlugins} from './plugins'; import {installCLI} from './utils/cli-install'; +import * as systemContextMenu from './utils/system-context-menu'; const commands: Record void> = { 'window:new': () => { @@ -123,6 +124,12 @@ const commands: Record void> = { if (process.platform !== 'darwin' && ['', true].includes(getConfig().showHamburgerMenu)) { Menu.getApplicationMenu()!.popup({x: 25, y: 22}); } + }, + 'systemContextMenu:add': () => { + systemContextMenu.add(); + }, + 'systemContextMenu:remove': () => { + systemContextMenu.remove(); } }; diff --git a/app/menus/menus/plugins.ts b/app/menus/menus/plugins.ts index 47a6a6c2..f23a2e5c 100644 --- a/app/menus/menus/plugins.ts +++ b/app/menus/menus/plugins.ts @@ -22,7 +22,26 @@ export default ( }, { type: 'separator' - } + }, + ...(process.platform === 'win32' + ? [ + { + label: 'Add Hyper to system context menu', + click() { + execCommand('systemContextMenu:add'); + } + }, + { + label: 'Remove Hyper from system context menu', + click() { + execCommand('systemContextMenu:remove'); + } + }, + { + type: 'separator' + } + ] + : []) ] }; };