mirror of
https://github.com/BoostIo/Boostnote
synced 2025-12-13 01:36:22 +00:00
added shortcut ctrl+q for quit and quit the app when using the Windows Close button
This commit is contained in:
@@ -43,7 +43,7 @@ if (process.platform !== 'linux' || process.env.DESKTOP_SESSION === 'cinnamon')
|
||||
mainWindow.on('close', function (e) {
|
||||
e.preventDefault()
|
||||
if (process.platform === 'win32') {
|
||||
mainWindow.minimize()
|
||||
quitApp()
|
||||
} else {
|
||||
if (mainWindow.isFullScreen()) {
|
||||
mainWindow.once('leave-full-screen', function () {
|
||||
@@ -51,26 +51,35 @@ if (process.platform !== 'linux' || process.env.DESKTOP_SESSION === 'cinnamon')
|
||||
})
|
||||
mainWindow.setFullScreen(false)
|
||||
} else {
|
||||
mainWindow.hide()
|
||||
quitApp()
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
app.on('before-quit', function (e) {
|
||||
try {
|
||||
config.set('windowsize', mainWindow.getBounds())
|
||||
} catch (e) {
|
||||
// ignore any errors because an error occurs only on update
|
||||
// refs: https://github.com/BoostIO/Boostnote/issues/243
|
||||
}
|
||||
storeWindowSize()
|
||||
mainWindow.removeAllListeners()
|
||||
})
|
||||
} else {
|
||||
app.on('window-all-closed', function () {
|
||||
app.quit()
|
||||
quitApp()
|
||||
})
|
||||
}
|
||||
|
||||
function quitApp () {
|
||||
storeWindowSize()
|
||||
app.quit()
|
||||
}
|
||||
|
||||
function storeWindowSize () {
|
||||
try {
|
||||
config.set('windowsize', mainWindow.getBounds())
|
||||
} catch (e) {
|
||||
// ignore any errors because an error occurs only on update
|
||||
// refs: https://github.com/BoostIO/Boostnote/issues/243
|
||||
}
|
||||
}
|
||||
|
||||
app.on('activate', function () {
|
||||
if (mainWindow == null) return null
|
||||
mainWindow.show()
|
||||
|
||||
Reference in New Issue
Block a user