Skip to content

Commit

Permalink
Only allow one instance of STTM (#543)
Browse files Browse the repository at this point in the history
* Only allow one instance of STTM

* fix braces
  • Loading branch information
tsingh777 authored and maneetpaul committed Mar 21, 2019
1 parent c288d31 commit 7cf62e9
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,20 @@ const emptyOverlay = () => {
}
};

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

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

app.on('ready', () => {
// Retrieve the userid value, and if it's not there, assign it a new uuid.
let userId = store.get('userId');
Expand Down

0 comments on commit 7cf62e9

Please sign in to comment.