mirror of
https://github.com/quine-global/hyper.git
synced 2026-01-12 20:18:41 -09:00
Add system context menu options in plugins menu
This commit is contained in:
parent
f169c2e906
commit
a78b3d9aea
2 changed files with 27 additions and 1 deletions
|
|
@ -2,6 +2,7 @@ import {app, Menu, BrowserWindow} from 'electron';
|
||||||
import {openConfig, getConfig} from './config';
|
import {openConfig, getConfig} from './config';
|
||||||
import {updatePlugins} from './plugins';
|
import {updatePlugins} from './plugins';
|
||||||
import {installCLI} from './utils/cli-install';
|
import {installCLI} from './utils/cli-install';
|
||||||
|
import * as systemContextMenu from './utils/system-context-menu';
|
||||||
|
|
||||||
const commands: Record<string, (focusedWindow?: BrowserWindow) => void> = {
|
const commands: Record<string, (focusedWindow?: BrowserWindow) => void> = {
|
||||||
'window:new': () => {
|
'window:new': () => {
|
||||||
|
|
@ -123,6 +124,12 @@ const commands: Record<string, (focusedWindow?: BrowserWindow) => void> = {
|
||||||
if (process.platform !== 'darwin' && ['', true].includes(getConfig().showHamburgerMenu)) {
|
if (process.platform !== 'darwin' && ['', true].includes(getConfig().showHamburgerMenu)) {
|
||||||
Menu.getApplicationMenu()!.popup({x: 25, y: 22});
|
Menu.getApplicationMenu()!.popup({x: 25, y: 22});
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
'systemContextMenu:add': () => {
|
||||||
|
systemContextMenu.add();
|
||||||
|
},
|
||||||
|
'systemContextMenu:remove': () => {
|
||||||
|
systemContextMenu.remove();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,26 @@ export default (
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: 'separator'
|
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'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
: [])
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue