Skip to content

Commit

Permalink
fix: Winmoji singleInstance only (#86)
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanSN authored Oct 26, 2018
1 parent adcf2db commit 999633a
Showing 1 changed file with 35 additions and 22 deletions.
57 changes: 35 additions & 22 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,29 +56,42 @@ const createWindow = () => {
})
}

app.on('will-quit', () => {
// clean up after ourselves
// Unregister a shortcut.
globalShortcut.unregister('CommandOrControl+X')
const lockSingleInstance = app.requestSingleInstanceLock()

// Unregister all shortcuts.
globalShortcut.unregisterAll()
})
if (!lockSingleInstance) {
app.quit()
} else {
app.on('second-instance', (event, commandLink, workingDirectory) => {
if (mainWindow) {
if (mainWindow.isMinimized()) mainWindow.restore()
mainWindow.focus()
}
})

app.on('ready', () => {
createWindow()
// mainWindow.webContents.openDevTools()
if (!isDev) {
updater.checkForUpdates()
}
})
app.on('will-quit', () => {
// clean up after ourselves
// Unregister a shortcut.
globalShortcut.unregister('CommandOrControl+X')

app.on('activate', () => {
mainWindow.show()
mainWindow.webContents.send('window-open')
})
// Unregister all shortcuts.
globalShortcut.unregisterAll()
})

app.on('before-quit', () => {
isQuitting = true
console.log(!mainWindow.isFullScreen())
})
app.on('ready', () => {
createWindow()
// mainWindow.webContents.openDevTools()
if (!isDev) {
updater.checkForUpdates()
}
})

app.on('activate', () => {
mainWindow.show()
mainWindow.webContents.send('window-open')
})

app.on('before-quit', () => {
isQuitting = true
console.log(!mainWindow.isFullScreen())
})
}

0 comments on commit 999633a

Please sign in to comment.