refs #1348 Add a menu to hide menu bar
This commit is contained in:
parent
2a974342c2
commit
8c68072686
|
@ -29,6 +29,7 @@
|
||||||
"toggle_full_screen": "Toggle Full Screen"
|
"toggle_full_screen": "Toggle Full Screen"
|
||||||
},
|
},
|
||||||
"window": {
|
"window": {
|
||||||
|
"always_show_menu_bar": "Always Show Menu Bar",
|
||||||
"name": "Window",
|
"name": "Window",
|
||||||
"close": "Close Window",
|
"close": "Close Window",
|
||||||
"open": "Open Window",
|
"open": "Open Window",
|
||||||
|
|
|
@ -1330,6 +1330,17 @@ const ApplicationMenu = (accountsChange: Array<MenuItemConstructorOptions>, i18n
|
||||||
{
|
{
|
||||||
label: i18n.t('main_menu.window.name'),
|
label: i18n.t('main_menu.window.name'),
|
||||||
submenu: [
|
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'),
|
label: i18n.t('main_menu.window.close'),
|
||||||
role: 'close'
|
role: 'close'
|
||||||
|
@ -1392,6 +1403,15 @@ const TrayMenu = (accountsChange: Array<MenuItemConstructorOptions>, i18n: I18n)
|
||||||
return menu
|
return menu
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function changeMenuAutoHide(autoHide: boolean) {
|
||||||
|
if (mainWindow === null) {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
mainWindow.autoHideMenuBar = autoHide
|
||||||
|
mainWindow.setMenuBarVisibility(!autoHide)
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
async function reopenWindow() {
|
async function reopenWindow() {
|
||||||
if (mainWindow === null) {
|
if (mainWindow === null) {
|
||||||
await createWindow()
|
await createWindow()
|
||||||
|
|
Loading…
Reference in New Issue