This repository was archived by the owner on Jun 26, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.ts
More file actions
executable file
·60 lines (53 loc) · 1.42 KB
/
main.ts
File metadata and controls
executable file
·60 lines (53 loc) · 1.42 KB
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
// noinspection ES6UnusedImports
import 'electron';
import {app, BrowserWindow, ipcMain} from 'electron/main';
import {exec} from "child_process";
require('@electron/remote/main').initialize();
const createWindow = () => {
const win = new BrowserWindow({
width: 800,
height: 600,
frame: false,
fullscreen: true,
show: false,
transparent: true,
webPreferences: {
contextIsolation: false,
nodeIntegration: true,
webviewTag: true,
sandbox: false,
nodeIntegrationInSubFrames: true,
},
icon: "icons/icon.png"
});
win.loadFile('src/index.html');
process.argv.forEach(arg => {
if (arg.startsWith("--app=")) {
(win as any).app = arg.replace("--app=", "");
}
});
(win as any).argv = process.argv;
(win as any).mainProcess = process;
exec("env | xargs", (err, stdout) => {
if (!err) {
(win as any).env = stdout.toString();
}
})
require("@electron/remote/main").enable(win.webContents);
}
app.whenReady().then(() => {
createWindow()
app.on('activate', () => {
if (BrowserWindow.getAllWindows().length === 0) {
createWindow();
}
});
});
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') {
app.quit();
}
});
ipcMain.on("close",() => {
app.quit();
});