Skip to content

Commit

Permalink
Ability to make menu bar persistently visible
Browse files Browse the repository at this point in the history
  • Loading branch information
klaudiosinani committed Oct 7, 2017
1 parent e2bb4f3 commit 2a9fd02
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 0 deletions.
13 changes: 13 additions & 0 deletions browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,17 @@ ipc.on('toggle-vibrant-dark-mode', () => {
vibrantDarkMode();
});

function toggleMenuBar() {
// Activates the menu bar on the main window
ipc.send('activate-menu-bar');
}

ipc.on('toggle-menu-bar', () => {
// Toggles on and off the menu bar
config.set('menuBarVisible', !config.get('menuBarVisible'));
toggleMenuBar();
});

function goToNote(key) {
const index = key;
selectNote(index);
Expand Down Expand Up @@ -470,6 +481,8 @@ document.addEventListener('DOMContentLoaded', () => {
// Preserve zoom factor
const zoomFactor = config.get('zoomFactor');
webFrame.setZoomFactor(zoomFactor);
// Toggle the menu bar
toggleMenuBar();
// Toggle sepia mode
sepiaMode();
// Toggle black mode
Expand Down
1 change: 1 addition & 0 deletions config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ module.exports = new Config({
width: 900,
height: 500
},
menuBarVisible: false,
darkMode: false,
blackMode: false,
sepiaMode: false,
Expand Down
15 changes: 15 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,21 @@ ipcMain.on('activate-vibrant', () => {
}
});

ipcMain.on('activate-menu-bar', () => {
// Check if the menu bar was activated
if (config.get('menuBarVisible')) {
// Make the menu bar persistently visible
mainWindow.setMenuBarVisibility(true);
// Disable ALT key toggling
mainWindow.setAutoHideMenuBar(false);
} else {
// Hide the menu bar
mainWindow.setMenuBarVisibility(false);
// Restore ALT key toggling
mainWindow.setAutoHideMenuBar(true);
}
});

ipcMain.on('print-to-pdf', event => {
// Get the current date-time
const dateTime = timeStamp('YYYY-MM-DD_HH-mm-ss');
Expand Down
7 changes: 7 additions & 0 deletions menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -762,6 +762,13 @@ const otherTpl = [{
}
}, {
type: 'separator'
}, {
label: 'Toggle Menu Bar',
type: 'checkbox',
checked: config.get('menuBarVisible'),
click() {
activate('toggle-menu-bar');
}
}, {
label: 'Toggle Full Screen',
accelerator: 'F11',
Expand Down

0 comments on commit 2a9fd02

Please sign in to comment.