From 4bac3ace186c5be2cb9409d2b703f960bd662145 Mon Sep 17 00:00:00 2001 From: TC Date: Fri, 27 Nov 2020 21:39:15 +0100 Subject: [PATCH] Option to hide menu (win/linux) --- index.js | 2 ++ menu.js | 13 +++++++++++++ store/index.js | 2 ++ 3 files changed, 17 insertions(+) diff --git a/index.js b/index.js index 1f45b7bc..4935c008 100644 --- a/index.js +++ b/index.js @@ -9,6 +9,7 @@ const { setApplicationMenu } = require("./menu"); const { autoUpdate, getEnabledPlugins, + hideMenu, isAppVisible, isTrayEnabled, store, @@ -85,6 +86,7 @@ function createMainWindow() { }, frame: !is.macOS(), titleBarStyle: is.macOS() ? "hiddenInset" : "default", + autoHideMenuBar: hideMenu(), }); if (windowMaximized) { win.maximize(); diff --git a/menu.js b/menu.js index b495dde1..0af131cb 100644 --- a/menu.js +++ b/menu.js @@ -7,6 +7,7 @@ const { enablePlugin, disablePlugin, autoUpdate, + hideMenu, isAppVisible, isTrayEnabled, setOptions, @@ -42,6 +43,18 @@ const mainMenuTemplate = (win) => [ setOptions({ autoUpdates: item.checked }); }, }, + ...(is.windows() || is.linux() + ? [ + { + label: "Hide menu", + type: "checkbox", + checked: hideMenu(), + click: (item) => { + setOptions({ hideMenu: item.checked }); + }, + }, + ] + : []), ...(is.windows() || is.macOS() ? // Only works on Win/Mac // https://www.electronjs.org/docs/api/app#appsetloginitemsettingssettings-macos-windows diff --git a/store/index.js b/store/index.js index 703b4d83..659d5bea 100644 --- a/store/index.js +++ b/store/index.js @@ -13,6 +13,7 @@ const store = new Store({ tray: false, appVisible: true, autoUpdates: true, + hideMenu: false, startAtLogin: false, }, }, @@ -31,5 +32,6 @@ module.exports = { isTrayEnabled: () => store.get("options.tray"), isAppVisible: () => store.get("options.appVisible"), autoUpdate: () => store.get("options.autoUpdates"), + hideMenu: () => store.get("options.hideMenu"), startAtLogin: () => store.get("options.startAtLogin"), };