Skip to content

Commit 6a982fe

Browse files
authored
Allow autohiding the menu bar on Windows & Linux (#28)
2 parents 4af3339 + 21f0d35 commit 6a982fe

File tree

4 files changed

+309
-104
lines changed

4 files changed

+309
-104
lines changed

package-lock.json

Lines changed: 184 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@
113113
"@sentry/integrations": "^6.7.1",
114114
"electron-context-menu": "^0.15.1",
115115
"electron-first-run": "^3.0.0",
116+
"electron-store": "^8.0.0",
116117
"electron-window-state": "^5.0.3",
117118
"os-proxy-config": "^1.1.1",
118119
"rimraf": "^2.7.1",

src/index.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ registerContextMenu({
5353
});
5454

5555
import { reportStartupEvents } from './report-install-event';
56-
import { menu } from './menu';
56+
import { getMenu, shouldAutoHideMenu } from './menu';
5757
import { getDeferred, delay } from './util';
5858

5959
const rmRF = promisify(rimraf);
@@ -112,6 +112,12 @@ const createWindow = () => {
112112

113113
show: false
114114
});
115+
116+
if (shouldAutoHideMenu()) {
117+
window.setAutoHideMenuBar(true);
118+
window.setMenuBarVisibility(false);
119+
}
120+
115121
windows.push(window);
116122

117123
windowState.manage(window);
@@ -539,7 +545,7 @@ if (!amMainInstance) {
539545
});
540546

541547
Promise.all([appReady.promise, portCheck]).then(() => {
542-
Menu.setApplicationMenu(menu);
548+
Menu.setApplicationMenu(getMenu(windows));
543549
createWindow();
544550
});
545551

0 commit comments

Comments
 (0)