aboutsummaryrefslogtreecommitdiff
path: root/src/modules/ipc.js
blob: 55737b799717b81e81a1820911c7ff217746dd1f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
const win = require("../win");
const { app, ipcMain } = require("electron");

const kill = require("./kill");
const settings = require("./settings");
const is_running = require("./is_running");

ipcMain.on("exit", () => {
	if (settings().originkill) {
		is_running.origin().then((running) => {
			if (running) {
				kill.origin().then(process.exit(0));
			} else {
				process.exit(0)	;
			}
		})
	} else {
		process.exit(0);
	}
})

ipcMain.on("minimize", () => {
	win().minimize();
})

ipcMain.on("relaunch", () => {
	app.relaunch({
		args: process.argv.slice(1)
	})

	app.exit(0);
})