Skip to content

Commit ae1fc75

Browse files
committed
add quit option to menu & fix sudden app quit caused by finder-window
1 parent 1a527cc commit ae1fc75

2 files changed

Lines changed: 30 additions & 7 deletions

File tree

atom-lib/finder-window.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,10 @@ nodeIpc.connectTo(
3636
'disconnect',
3737
function () {
3838
nodeIpc.log('<< disconnected from main'.notice)
39-
appQuit = true
40-
app.quit()
39+
if (process.platform === 'darwin') {
40+
appQuit = true
41+
app.quit()
42+
}
4143
}
4244
)
4345
nodeIpc.of.main.on(
@@ -95,9 +97,11 @@ finderWindow.on('blur', function () {
9597
})
9698

9799
finderWindow.on('close', function (e) {
98-
if (appQuit) return true
99-
e.preventDefault()
100-
finderWindow.hide()
100+
if (process.platform === 'darwin') {
101+
if (appQuit) return true
102+
e.preventDefault()
103+
finderWindow.hide()
104+
}
101105
})
102106

103107
var appIcon = new Tray(path.join(__dirname, '../resources/tray-icon.png'))

main.js

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ var handleStartupEvent = function () {
5656
return false
5757
}
5858

59-
var squirrelCommand = process.argv[1];
59+
var squirrelCommand = process.argv[1]
6060
switch (squirrelCommand) {
6161
case '--squirrel-install':
6262
spawnUpdate(['--createShortcut', exeName], function (err) {
@@ -228,8 +228,24 @@ app.on('ready', function () {
228228
})
229229

230230
var template = require('./atom-lib/menu-template')
231+
if (process.platform === 'win32') {
232+
template.unshift({
233+
label: 'Boostnote',
234+
submenu: [
235+
{
236+
label: 'Quit',
237+
accelerator: 'Control+Q',
238+
click: function (e) {
239+
quitApp()
240+
}
241+
}
242+
]
243+
})
244+
}
231245
var menu = Menu.buildFromTemplate(template)
232-
Menu.setApplicationMenu(menu)
246+
if (process.platform === 'darwin') {
247+
Menu.setApplicationMenu(menu)
248+
}
233249

234250
if (process.platform === 'darwin') {
235251
setInterval(function () {
@@ -268,6 +284,9 @@ app.on('ready', function () {
268284
}
269285

270286
mainWindow = require('./atom-lib/main-window')
287+
if (process.platform === 'win32') {
288+
mainWindow.setMenu(menu)
289+
}
271290
mainWindow.on('close', function (e) {
272291
if (appQuit) return true
273292
e.preventDefault()

0 commit comments

Comments
 (0)