Skip to content

Commit

Permalink
Added AutoHide Menu Bar Feature.
Browse files Browse the repository at this point in the history
  • Loading branch information
cstayyab committed May 16, 2020
1 parent 04b8b15 commit 437dc46
Showing 1 changed file with 23 additions and 2 deletions.
25 changes: 23 additions & 2 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,11 @@ var settings = new Store({
value: false,
name: 'Dark Mode',
description: 'Enable Dark Mode in WhatsApp Web'
},
autoHideMenuBar: {
value: false,
name: "Auo-Hide Menu Bar",
description: "Auto-hide top menu bar"
}
}
});
Expand Down Expand Up @@ -200,6 +205,20 @@ const settingsMenu = [{
integrateToDesktop(window);
},
visible: process.env.APPIMAGE !== undefined
}, {
label: "Auto-Hide Menu Bar",
sublabel: "Toggle menu bar visibility using Alt",
type: 'checkbox',
checked: settings.get("autoHideMenuBar.value"),
click: (menuItem) => {
settings.set('autoHideMenuBar.value', menuItem.checked);
if(menuItem.checked) {
win.setMenuBarVisibility(false);
} else {
win.setMenuBarVisibility(true);
}
win.setAutoHideMenuBar(menuItem.checked);
}
}];
const windowMenu = [{
label: 'Debug Tools',
Expand Down Expand Up @@ -366,7 +385,8 @@ function loadWA() {
}
const menubar = Menu.buildFromTemplate(mainmenu);
Menu.setApplicationMenu(menubar);
win.setMenuBarVisibility(true);
win.setMenuBarVisibility(!settings.get('autoHideMenuBar.value'));

win.loadURL('https://web.whatsapp.com', { 'userAgent': userAgent }).then(async () => {
if(settings.get('darkMode.value')) {
win.webContents.send("enableDarkMode");
Expand Down Expand Up @@ -489,7 +509,8 @@ function createWindow() {
},
show: !settings.get('startHidden.value'),
});
win.setMenuBarVisibility(false);
win.setMenuBarVisibility(!settings.get('autoHideMenuBar.value'));
win.setAutoHideMenuBar(settings.get('autoHideMenuBar.value'));
win.setAlwaysOnTop(settings.get('alwaysOnTop.value'));
trayIcon = new Tray(path.join(__dirname, 'icons/logo256x256.png'));
//Hide Default menubar
Expand Down

0 comments on commit 437dc46

Please sign in to comment.