Skip to content

Commit

Permalink
Optimize the menu bar for macOS (#120)
Browse files Browse the repository at this point in the history
Co-authored-by: V <[email protected]>
  • Loading branch information
X1nto and Vendicated committed Sep 30, 2023
1 parent a9bfb85 commit 89af431
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 9 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
dist
node_modules
.env
.DS_Store
.idea/
44 changes: 35 additions & 9 deletions src/main/mainWindow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,8 @@ async function clearData(win: BrowserWindow) {
app.quit();
}

type MenuItemList = Array<MenuItemConstructorOptions | false>;

function initMenuBar(win: BrowserWindow) {
const isWindows = process.platform === "win32";
const isDarwin = process.platform === "darwin";
Expand Down Expand Up @@ -181,14 +183,38 @@ function initMenuBar(win: BrowserWindow) {
app.quit();
}
},
isDarwin && {
label: "Hide",
role: "hide"
},
isDarwin && {
label: "Hide others",
role: "hideOthers"
},
...(!isDarwin
? []
: ([
{
type: "separator"
},
{
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",
accelerator: wantCtrlQ ? "CmdOrCtrl+Q" : void 0,
Expand All @@ -213,7 +239,7 @@ function initMenuBar(win: BrowserWindow) {
role: "zoomIn",
visible: false
}
] satisfies Array<MenuItemConstructorOptions | false>;
] satisfies MenuItemList;

const menu = Menu.buildFromTemplate([
{
Expand Down

0 comments on commit 89af431

Please sign in to comment.