feat: add macOS menu actions for webview reload and restart
This commit is contained in:
@@ -1118,6 +1118,20 @@ const dispatchCheckForUpdates = () => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const reloadMenuTargetWindow = () => {
|
||||||
|
const target = getMenuTargetWindow();
|
||||||
|
if (!target || target.isDestroyed()) return;
|
||||||
|
target.webContents.reload();
|
||||||
|
};
|
||||||
|
|
||||||
|
const relaunchFromMenu = () => {
|
||||||
|
prepareForQuit();
|
||||||
|
setImmediate(() => {
|
||||||
|
app.relaunch();
|
||||||
|
app.exit(0);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
const nextWindowLabel = () => {
|
const nextWindowLabel = () => {
|
||||||
const value = state.windowCounter++;
|
const value = state.windowCounter++;
|
||||||
return value === 1 ? 'main' : `main-${value}`;
|
return value === 1 ? 'main' : `main-${value}`;
|
||||||
@@ -2388,6 +2402,8 @@ const buildMacMenu = () => {
|
|||||||
},
|
},
|
||||||
{ type: 'separator' },
|
{ type: 'separator' },
|
||||||
{ label: 'Settings', accelerator: 'Cmd+,', click: () => dispatchAction('settings') },
|
{ label: 'Settings', accelerator: 'Cmd+,', click: () => dispatchAction('settings') },
|
||||||
|
{ label: 'Reload Webview', click: () => reloadMenuTargetWindow() },
|
||||||
|
{ label: 'Restart', click: () => relaunchFromMenu() },
|
||||||
{ label: 'Command Palette', accelerator: 'Cmd+P', click: () => dispatchAction('command-palette') },
|
{ label: 'Command Palette', accelerator: 'Cmd+P', click: () => dispatchAction('command-palette') },
|
||||||
{ type: 'separator' },
|
{ type: 'separator' },
|
||||||
{ role: 'services' },
|
{ role: 'services' },
|
||||||
|
|||||||
Reference in New Issue
Block a user