feat: reuse built-in menus in system menubar (#12)
* fix: add edit menu on macOS to allow clipboard actions * feat: reuse more built-in menus * re-add zoom shortcut fix --------- Co-authored-by: V <vendicated@riseup.net>
This commit is contained in:
parent
70dd38f79d
commit
583680d311
1 changed files with 11 additions and 36 deletions
|
@ -84,9 +84,11 @@ function initMenuBar(win: BrowserWindow) {
|
||||||
const menu = Menu.buildFromTemplate([
|
const menu = Menu.buildFromTemplate([
|
||||||
{
|
{
|
||||||
label: "Vencord Desktop",
|
label: "Vencord Desktop",
|
||||||
|
role: "appMenu",
|
||||||
submenu: [
|
submenu: [
|
||||||
{
|
{
|
||||||
label: "About Vencord Desktop",
|
label: "About Vencord Desktop",
|
||||||
|
role: "about",
|
||||||
click: createAboutWindow
|
click: createAboutWindow
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -98,28 +100,6 @@ function initMenuBar(win: BrowserWindow) {
|
||||||
},
|
},
|
||||||
toolTip: "Vencord Desktop will automatically restart after this operation"
|
toolTip: "Vencord Desktop will automatically restart after this operation"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
label: "Toggle Developer Tools",
|
|
||||||
accelerator: "CmdOrCtrl+Shift+I",
|
|
||||||
click() {
|
|
||||||
BrowserWindow.getFocusedWindow()!.webContents.toggleDevTools();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "Toggle Developer Tools (Hidden)",
|
|
||||||
accelerator: "F12",
|
|
||||||
visible: false,
|
|
||||||
click() {
|
|
||||||
BrowserWindow.getFocusedWindow()!.webContents.toggleDevTools();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "Reload Window",
|
|
||||||
accelerator: "CmdOrCtrl+R",
|
|
||||||
click() {
|
|
||||||
BrowserWindow.getFocusedWindow()!.webContents.reload();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
label: "Relaunch",
|
label: "Relaunch",
|
||||||
accelerator: "CmdOrCtrl+Shift+R",
|
accelerator: "CmdOrCtrl+Shift+R",
|
||||||
|
@ -132,6 +112,7 @@ function initMenuBar(win: BrowserWindow) {
|
||||||
label: "Quit",
|
label: "Quit",
|
||||||
accelerator: wantCtrlQ ? "CmdOrCtrl+Q" : void 0,
|
accelerator: wantCtrlQ ? "CmdOrCtrl+Q" : void 0,
|
||||||
visible: !isWindows,
|
visible: !isWindows,
|
||||||
|
role: "quit",
|
||||||
click() {
|
click() {
|
||||||
app.quit();
|
app.quit();
|
||||||
}
|
}
|
||||||
|
@ -140,34 +121,28 @@ function initMenuBar(win: BrowserWindow) {
|
||||||
label: "Quit",
|
label: "Quit",
|
||||||
accelerator: isWindows ? "Alt+F4" : void 0,
|
accelerator: isWindows ? "Alt+F4" : void 0,
|
||||||
visible: isWindows,
|
visible: isWindows,
|
||||||
|
role: "quit",
|
||||||
click() {
|
click() {
|
||||||
app.quit();
|
app.quit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{ role: "fileMenu" },
|
||||||
|
{ role: "editMenu" },
|
||||||
|
{ role: "viewMenu" },
|
||||||
|
{ role: "windowMenu" },
|
||||||
{
|
{
|
||||||
label: "Zoom",
|
label: "Zoom",
|
||||||
submenu: [
|
submenu: [
|
||||||
{
|
|
||||||
label: "Zoom in",
|
|
||||||
accelerator: "CmdOrCtrl+Plus",
|
|
||||||
role: "zoomIn"
|
|
||||||
},
|
|
||||||
// Fix for zoom in on keyboards with dedicated + like QWERTZ (or numpad)
|
|
||||||
// See https://github.com/electron/electron/issues/14742 and https://github.com/electron/electron/issues/5256
|
// See https://github.com/electron/electron/issues/14742 and https://github.com/electron/electron/issues/5256
|
||||||
{
|
{
|
||||||
label: "Zoom in",
|
label: "Zoom in",
|
||||||
accelerator: "CmdOrCtrl+=",
|
accelerator: "CmdOrCtrl+=",
|
||||||
role: "zoomIn",
|
role: "zoomIn"
|
||||||
visible: false
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "Zoom out",
|
|
||||||
accelerator: "CmdOrCtrl+-",
|
|
||||||
role: "zoomOut"
|
|
||||||
}
|
}
|
||||||
]
|
],
|
||||||
|
visible: false
|
||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue