Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions lib/main-menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,17 @@ const boost = macOS
},
{
label: 'Quit Boostnote',
role: 'quit'
role: 'quit',
accelerator: 'CommandOrControl+Q'
}
]
}
: {
label: 'Boostnote',
submenu: [
{
role: 'quit'
role: 'quit',
accelerator: 'Control+Q'
}
]
}
Expand Down Expand Up @@ -131,7 +133,8 @@ if (LINUX) {
file.submenu.push({
type: 'separator'
}, {
role: 'quit'
role: 'quit',
accelerator: 'Control+Q'
})
}

Expand Down
27 changes: 18 additions & 9 deletions lib/main-window.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,34 +43,43 @@ 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 () {
mainWindow.hide()
})
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()
Expand Down