1
0
mirror of https://github.com/BoostIo/Boostnote synced 2025-12-15 18:56:22 +00:00

Merge branch 'master' of github.com:BoostIO/Boostnote

This commit is contained in:
Dick Choi
2016-08-14 17:37:21 +09:00
5 changed files with 24 additions and 10 deletions

View File

@@ -11,7 +11,7 @@ const { clipboard } = electron
const path = require('path') const path = require('path')
function notify (title, options) { function notify (title, options) {
if (process.platform === 'win32') { if (global.process.platform === 'win32') {
options.icon = path.join('file://', global.__dirname, '../../resources/app.png') options.icon = path.join('file://', global.__dirname, '../../resources/app.png')
} }
return new window.Notification(title, options) return new window.Notification(title, options)

View File

@@ -15,11 +15,12 @@ const { remote } = electron
const { Menu } = remote const { Menu } = remote
function hideFinder () { function hideFinder () {
if (process.platform === 'win32') { let finderWindow = remote.getCurrentWindow()
remote.getCurrentWindow().minimize() if (global.process.platform === 'win32') {
return finderWindow.blur()
finderWindow.hide()
} }
if (process.platform === 'darwin') { if (global.process.platform === 'darwin') {
Menu.sendActionToFirstResponder('hide:') Menu.sendActionToFirstResponder('hide:')
} }
remote.getCurrentWindow().hide() remote.getCurrentWindow().hide()
@@ -48,6 +49,7 @@ class FinderMain extends React.Component {
} }
componentDidMount () { componentDidMount () {
this.refs.search.focus()
window.addEventListener('focus', this.focusHandler) window.addEventListener('focus', this.focusHandler)
window.addEventListener('blur', this.blurHandler) window.addEventListener('blur', this.blurHandler)
} }

View File

@@ -30,12 +30,21 @@ function toggleFinder () {
finderWindow.show() finderWindow.show()
} }
} else { } else {
if (!finderWindow.isMinimized()) { if (finderWindow.isVisible()) {
finderWindow.minimize() finderWindow.blur()
finderWindow.hide()
} else { } else {
nodeIpc.of.node.emit('request-data') nodeIpc.of.node.emit('request-data')
finderWindow.restore() finderWindow.show()
finderWindow.focus()
} }
// if (!finderWindow.isMinimized()) {
// finderWindow.minimize()
// } else {
// nodeIpc.of.node.emit('request-data')
// finderWindow.restore()
// finderWindow.focus()
// }
} }
} }

View File

@@ -49,7 +49,7 @@ var boost = OSX
submenu: [ submenu: [
{ {
label: 'Quit', label: 'Quit',
accelerator: 'Command+Q', accelerator: 'Control+Q',
click: function () { click: function () {
mainWindow.webContents.send('quit-app', {}) mainWindow.webContents.send('quit-app', {})
} }
@@ -88,7 +88,7 @@ if (LINUX) {
label: 'Quit Boostnote', label: 'Quit Boostnote',
accelerator: 'Control + Q', accelerator: 'Control + Q',
click: function () { click: function () {
mainWindow.close() mainWindow.webContents.send('quit-app', {})
} }
}) })
} }

View File

@@ -33,6 +33,9 @@ mainWindow.webContents.sendInputEvent({
}) })
mainWindow.on('close', function (e) { mainWindow.on('close', function (e) {
if (process.platform === 'linux' && process.env.DESKTOP_SESSION !== 'cinnamon') {
return true
}
mainWindow.hide() mainWindow.hide()
e.preventDefault() e.preventDefault()
}) })