mirror of
https://github.com/BoostIo/Boostnote
synced 2025-12-13 17:56:25 +00:00
added shortcut ctrl+q for quit and quit the app when using the Windows Close button
This commit is contained in:
@@ -37,7 +37,8 @@ const boost = macOS
|
||||
},
|
||||
{
|
||||
label: 'Quit Boostnote',
|
||||
role: 'quit'
|
||||
role: 'quit',
|
||||
accelerator: 'CommandOrControl+Q'
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -45,7 +46,8 @@ const boost = macOS
|
||||
label: 'Boostnote',
|
||||
submenu: [
|
||||
{
|
||||
role: 'quit'
|
||||
role: 'quit',
|
||||
accelerator: 'Control+Q'
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -131,7 +133,8 @@ if (LINUX) {
|
||||
file.submenu.push({
|
||||
type: 'separator'
|
||||
}, {
|
||||
role: 'quit'
|
||||
role: 'quit',
|
||||
accelerator: 'Control+Q'
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -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,24 +51,33 @@ if (process.platform !== 'linux' || process.env.DESKTOP_SESSION === 'cinnamon')
|
||||
})
|
||||
mainWindow.setFullScreen(false)
|
||||
} else {
|
||||
mainWindow.hide()
|
||||
quitApp()
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
app.on('before-quit', function (e) {
|
||||
storeWindowSize()
|
||||
mainWindow.removeAllListeners()
|
||||
})
|
||||
} else {
|
||||
app.on('window-all-closed', function () {
|
||||
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
|
||||
}
|
||||
mainWindow.removeAllListeners()
|
||||
})
|
||||
} else {
|
||||
app.on('window-all-closed', function () {
|
||||
app.quit()
|
||||
})
|
||||
}
|
||||
|
||||
app.on('activate', function () {
|
||||
|
||||
Reference in New Issue
Block a user