Skip to content

Commit 48f2a6f

Browse files
Fix launching settings when opening second instance
1 parent f24c09b commit 48f2a6f

File tree

1 file changed

+6
-18
lines changed

1 file changed

+6
-18
lines changed

app/main/index.ts

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7,30 +7,18 @@ import { setAutoLauch } from "./lib/auto-launch";
77
import { initBreaks } from "./lib/breaks";
88
import "./lib/ipc";
99
import { showNotification } from "./lib/notifications";
10-
import {
11-
getAppInitialized,
12-
setAppInitialized,
13-
setBreaksEnabled
14-
} from "./lib/store";
10+
import { getAppInitialized, setAppInitialized } from "./lib/store";
1511
import { initTray } from "./lib/tray";
1612
import { createSettingsWindow, createSoundsWindow } from "./lib/windows";
1713

1814
const gotTheLock = app.requestSingleInstanceLock();
1915

20-
if (!gotTheLock) {
21-
const cliArg = process.argv[process.argv.length - 1];
22-
23-
if (cliArg === "disable") {
24-
console.log("breaks disabled");
25-
setBreaksEnabled(false);
26-
} else if (cliArg === "enable") {
27-
console.log("breaks enabled");
28-
setBreaksEnabled(true);
29-
} else {
30-
console.log("app already open, opening settings");
31-
createSettingsWindow();
32-
}
16+
app.on("second-instance", () => {
17+
createSettingsWindow();
18+
});
3319

20+
if (!gotTheLock) {
21+
log.info("app already running");
3422
app.exit();
3523
}
3624

0 commit comments

Comments
 (0)