Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimize the menu bar for macOS #120

Merged
merged 8 commits into from
Sep 30, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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/
40 changes: 31 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,34 @@ 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()")
X1nto marked this conversation as resolved.
Show resolved Hide resolved
}
},
{
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 +235,7 @@ function initMenuBar(win: BrowserWindow) {
role: "zoomIn",
visible: false
}
] satisfies Array<MenuItemConstructorOptions | false>;
] satisfies MenuItemList;

const menu = Menu.buildFromTemplate([
{
Expand Down