Skip to content

Commit

Permalink
only allow single instace - on 2nd, focus 1st + kill 2nd (fixes #84)
Browse files Browse the repository at this point in the history
  • Loading branch information
Rik Smith-Unna committed Jun 23, 2017
1 parent f2882fe commit 76a13b0
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions app/run.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,24 @@
const { app, BrowserWindow, protocol } = require('electron')

let main = null

const shouldQuit = app.makeSingleInstance((cliargs, cwd) => {
// Someone tried to run a second instance, we should focus our window.
if (main) {
if (main.isMinimized()) main.restore()
main.focus()
}
})

if (shouldQuit) {
return app.quit()
}

require('electron-debug')({ enabled: true })

const path = require('path')
const open = require('opn')

var main = null

app.commandLine.appendSwitch('enable-features', 'V8Ignition')
app.commandLine.appendSwitch('enable-webassembly')

Expand Down

0 comments on commit 76a13b0

Please sign in to comment.