aboutsummaryrefslogtreecommitdiff
path: root/src/modules/ipc.js
blob: 57820b5a67c4269776bd07c50ce4b6f20be04f7c (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
33
34
35
36
37
38
39
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);
})

ipcMain.on("send-enter-key", (e, coords) => {
	e.sender.sendInputEvent({
		type: "char",
		keyCode: "enter"
	})
})