From 8c680726861608cbc95d2b4ca4c11d616021442b Mon Sep 17 00:00:00 2001
From: AkiraFukushima
Date: Sun, 7 Jun 2020 00:19:41 +0900
Subject: [PATCH] refs #1348 Add a menu to hide menu bar
---
src/config/locales/en/translation.json | 1 +
src/main/index.ts | 20 ++++++++++++++++++++
2 files changed, 21 insertions(+)
diff --git a/src/config/locales/en/translation.json b/src/config/locales/en/translation.json
index e3199adb..60e2f76b 100644
--- a/src/config/locales/en/translation.json
+++ b/src/config/locales/en/translation.json
@@ -29,6 +29,7 @@
"toggle_full_screen": "Toggle Full Screen"
},
"window": {
+ "always_show_menu_bar": "Always Show Menu Bar",
"name": "Window",
"close": "Close Window",
"open": "Open Window",
diff --git a/src/main/index.ts b/src/main/index.ts
index 9fd7e7b5..c16a7f6d 100644
--- a/src/main/index.ts
+++ b/src/main/index.ts
@@ -1330,6 +1330,17 @@ const ApplicationMenu = (accountsChange: Array, i18n
{
label: i18n.t('main_menu.window.name'),
submenu: [
+ {
+ label: i18n.t('main_menu.window.always_show_menu_bar'),
+ type: 'checkbox',
+ checked: true,
+ click: item => {
+ changeMenuAutoHide(!item.checked)
+ }
+ },
+ {
+ type: 'separator'
+ },
{
label: i18n.t('main_menu.window.close'),
role: 'close'
@@ -1392,6 +1403,15 @@ const TrayMenu = (accountsChange: Array, i18n: I18n)
return menu
}
+async function changeMenuAutoHide(autoHide: boolean) {
+ if (mainWindow === null) {
+ return null
+ }
+ mainWindow.autoHideMenuBar = autoHide
+ mainWindow.setMenuBarVisibility(!autoHide)
+ return null
+}
+
async function reopenWindow() {
if (mainWindow === null) {
await createWindow()