Skip to content

Commit

Permalink
Merge branch 'develop' of github.com:meetfranz/franz into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
adlk committed Nov 6, 2017
2 parents 08c45d3 + 6acb046 commit 4e75616
Showing 1 changed file with 15 additions and 19 deletions.
34 changes: 15 additions & 19 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,18 @@ if (isWindows) {
}

// Force single window
if (process.platform !== 'darwin') {
const isSecondInstance = app.makeSingleInstance(() => {
if (mainWindow) {
if (mainWindow.isMinimized()) mainWindow.restore();
mainWindow.focus();
}
});

if (isSecondInstance) {
app.quit();
const isSecondInstance = app.makeSingleInstance(() => {
if (mainWindow) {
if (mainWindow.isMinimized()) mainWindow.restore();
mainWindow.focus();
}
});

if (isSecondInstance) {
app.exit();
}


// Initialize Settings
const settings = new Settings();

Expand Down Expand Up @@ -86,9 +85,13 @@ const createWindow = async () => {
// when you should delete the corresponding element.
if (!willQuitApp && (settings.get('runInBackground') === undefined || settings.get('runInBackground'))) {
e.preventDefault();
mainWindow.hide();
if (isWindows) {
mainWindow.minimize();
} else {
mainWindow.hide();
}

if (process.platform === 'win32') {
if (isWindows && settings.get('minimizeToSystemTray')) {
mainWindow.setSkipTaskbar(true);
}
} else {
Expand All @@ -111,13 +114,6 @@ const createWindow = async () => {
app.isMaximized = true;
});

mainWindow.on('close', (e) => {
if (settings.get('minimizeToSystemTray')) {
e.preventDefault();
mainWindow.minimize();
}
});

mainWindow.on('unmaximize', () => {
app.isMaximized = false;
});
Expand Down

0 comments on commit 4e75616

Please sign in to comment.