Add menu to reopen window after close window in macOS

This commit is contained in:
AkiraFukushima 2018-10-10 09:05:21 +09:00
parent a59646307f
commit 2b19f103e0
7 changed files with 26 additions and 2 deletions

View File

@ -30,6 +30,7 @@
"window": {
"name": "Fenster",
"close": "Fenster schließen",
"open": "Open Window",
"minimize": "Minimieren",
"jump_to": "Springe zu"
}

View File

@ -30,6 +30,7 @@
"window": {
"name": "Window",
"close": "Close Window",
"open": "Open Window",
"minimize": "Minimize",
"jump_to": "Jump to"
}

View File

@ -30,6 +30,7 @@
"window": {
"name": "Fenêtre",
"close": "Fermer la fenêtre",
"open": "Open Window",
"minimize": "Minimiser",
"jump_to": "Aller à"
}

View File

@ -29,7 +29,8 @@
},
"window": {
"name": "ウィンドウ",
"close": "閉じる",
"close": "ウィンドウを閉じる",
"open": "ウィンドウを表示",
"minimize": "縮小",
"jump_to": "ジャンプ"
}

View File

@ -30,6 +30,7 @@
"window": {
"name": "창",
"close": "창 닫기",
"open": "Open Window",
"minimize": "최소화",
"jump_to": "이동"
}

View File

@ -30,6 +30,7 @@
"window": {
"name": "Okno",
"close": "Zamknij okno",
"open": "Open Window",
"minimize": "Zminimalizuj",
"jump_to": "Przejdź do"
}

View File

@ -227,8 +227,10 @@ app.on('window-all-closed', () => {
menu.items[0].submenu.items[2].enabled = false
// New Toot
menu.items[1].submenu.items[0].enabled = false
// Open Window
menu.items[4].submenu.items[1].enabled = true
// Jump to
menu.items[4].submenu.items[3].enabled = false
menu.items[4].submenu.items[4].enabled = false
}
})
@ -870,6 +872,13 @@ const ApplicationMenu = (accountsChange, i18n) => {
label: i18n.t('main_menu.window.close'),
role: 'close'
},
{
label: i18n.t('main_menu.window.open'),
enabled: false,
click: () => {
reopenWindow()
}
},
{
label: i18n.t('main_menu.window.minimize'),
role: 'minimize'
@ -896,3 +905,12 @@ const ApplicationMenu = (accountsChange, i18n) => {
const menu = Menu.buildFromTemplate(template)
Menu.setApplicationMenu(menu)
}
async function reopenWindow () {
if (mainWindow === null) {
await createWindow()
return null
} else {
return null
}
}