Permalink
Browse files

fix(App): Force Franz to use single window

Fixes #29
  • Loading branch information...
adlk committed Oct 23, 2017
1 parent 8e3dcd4 commit 2ae409e1f2622b509703ed814d3aa8f4e136d09a
Showing with 15 additions and 1 deletion.
  1. +15 −1 src/index.js
@@ -18,7 +18,6 @@ import './electron/exception';
// Keep a global reference of the window object, if you don't, the window will
// be closed automatically when the JavaScript object is garbage collected.
let mainWindow;
const settings = new Settings();
let willQuitApp = false;
// Ensure that the recipe directory exists
@@ -29,6 +28,21 @@ if (isWindows) {
app.setAppUserModelId(appId);
}
// Force single window
const isSecondInstance = app.makeSingleInstance(() => {
if (mainWindow) {
if (mainWindow.isMinimized()) mainWindow.restore();
mainWindow.focus();
}
});
if (isSecondInstance) {
app.quit();
}
// Initialize Settings
const settings = new Settings();
const createWindow = async () => {
// Remember window size
const mainWindowState = windowStateKeeper({

0 comments on commit 2ae409e

Please sign in to comment.