quit properly (fixes #109)

This commit is contained in:
Eugene Pankov
2017-07-12 20:24:35 +02:00
parent 1643ca2bd5
commit c41efbd62b
5 changed files with 1 additions and 41 deletions

View File

@@ -30,28 +30,18 @@ if (!process.env.TERMINUS_PLUGINS) {
}
setupWindowManagement = () => {
let windowCloseable
app.window.on('show', () => {
app.window.webContents.send('host:window-shown')
})
app.window.on('close', (e) => {
windowConfig.set('windowBoundaries', app.window.getBounds())
if (!windowCloseable) {
app.window.minimize()
e.preventDefault()
}
})
app.window.on('closed', () => {
app.window = null
})
electron.ipcMain.on('window-closeable', (event, flag) => {
windowCloseable = flag
})
electron.ipcMain.on('window-focus', () => {
app.window.focus()
})
@@ -102,8 +92,6 @@ setupWindowManagement = () => {
electron.ipcMain.on('window-set-always-on-top', (event, flag) => {
app.window.setAlwaysOnTop(flag)
})
app.on('before-quit', () => windowCloseable = true)
}
@@ -131,7 +119,7 @@ setupMenu = () => {
label: 'Quit',
accelerator: 'Cmd+Q',
click () {
app.window.webContents.send('host:quit-request')
app.quit()
}
}
]