Optimize the menu bar for macOS (#120)
Co-authored-by: V <vendicated@riseup.net>
This commit is contained in:
parent
a9bfb857ae
commit
89af4316d3
2 changed files with 37 additions and 9 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -1,3 +1,5 @@
|
||||||
dist
|
dist
|
||||||
node_modules
|
node_modules
|
||||||
.env
|
.env
|
||||||
|
.DS_Store
|
||||||
|
.idea/
|
|
@ -147,6 +147,8 @@ async function clearData(win: BrowserWindow) {
|
||||||
app.quit();
|
app.quit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type MenuItemList = Array<MenuItemConstructorOptions | false>;
|
||||||
|
|
||||||
function initMenuBar(win: BrowserWindow) {
|
function initMenuBar(win: BrowserWindow) {
|
||||||
const isWindows = process.platform === "win32";
|
const isWindows = process.platform === "win32";
|
||||||
const isDarwin = process.platform === "darwin";
|
const isDarwin = process.platform === "darwin";
|
||||||
|
@ -181,14 +183,38 @@ function initMenuBar(win: BrowserWindow) {
|
||||||
app.quit();
|
app.quit();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
isDarwin && {
|
...(!isDarwin
|
||||||
label: "Hide",
|
? []
|
||||||
role: "hide"
|
: ([
|
||||||
},
|
{
|
||||||
isDarwin && {
|
type: "separator"
|
||||||
label: "Hide others",
|
},
|
||||||
role: "hideOthers"
|
{
|
||||||
},
|
label: "Settings",
|
||||||
|
accelerator: "CmdOrCtrl+,",
|
||||||
|
async click() {
|
||||||
|
mainWin.webContents.executeJavaScript(
|
||||||
|
"Vencord.Webpack.Common.SettingsRouter.open('My Account')"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: "separator"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "Hide Vesktop", // Should probably remove the label, but it says "Hide VencordDesktop" instead of "Hide Vesktop"
|
||||||
|
role: "hide"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
role: "hideOthers"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
role: "unhide"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: "separator"
|
||||||
|
}
|
||||||
|
] satisfies MenuItemList)),
|
||||||
{
|
{
|
||||||
label: "Quit",
|
label: "Quit",
|
||||||
accelerator: wantCtrlQ ? "CmdOrCtrl+Q" : void 0,
|
accelerator: wantCtrlQ ? "CmdOrCtrl+Q" : void 0,
|
||||||
|
@ -213,7 +239,7 @@ function initMenuBar(win: BrowserWindow) {
|
||||||
role: "zoomIn",
|
role: "zoomIn",
|
||||||
visible: false
|
visible: false
|
||||||
}
|
}
|
||||||
] satisfies Array<MenuItemConstructorOptions | false>;
|
] satisfies MenuItemList;
|
||||||
|
|
||||||
const menu = Menu.buildFromTemplate([
|
const menu = Menu.buildFromTemplate([
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue