This repository has been archived by the owner on Jul 10, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
77 lines (62 loc) · 1.71 KB
/
index.js
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
/* PACKAGES */
require("v8-compile-cache");
const { app, BrowserWindow, ipcMain } = require("electron");
const path = require("path");
/* MODULES */
const IpcMain = require("./modules/ipcMain.js");
const appInitialization = require("./modules/appInitialization.js");
/* MAIN PROCESS */
appInitialization(
path.join(app.getPath("appData"), "./Hisnmuslim"),
app.getVersion()
);
const createWindow = async () => {
var mainWindow = new BrowserWindow({
width: 980,
height: 600,
minWidth: 980,
minHeight:600,
center: true,
show: false,
frame: false,
title: "Hisnmuslim - حصن المسلم",
icon: path.join(__dirname, 'build/icon.png'),
webPreferences: {
nodeIntegration: true,
sandbox: false,
preload: path.join(__dirname, "preload.js"),
},
});
mainWindow.loadFile(path.join(__dirname, "pages/home.html"));
//mainWindow.webContents.openDevTools();
mainWindow.removeMenu();
mainWindow.once("ready-to-show", () => {
mainWindow?.show();
});
mainWindow.on("minimize", (event) => {
event?.preventDefault();
//mainWindow?.hide();
});
mainWindow?.on("closed", (event) => {
event?.preventDefault();
mainWindow = null;
app?.quit();
});
/* Communicate asynchronously from the main process to renderer processes. */
IpcMain(ipcMain, mainWindow, path.join(app.getPath("appData"), "./Hisnmuslim"));
};
app.on("ready", async (e) => {
e.preventDefault();
app.setAppUserModelId("org.rn0x.hisnmuslim");
await createWindow();
});
app.on("window-all-closed", () => {
if (process.platform !== "darwin") {
app.quit();
}
});
app.on("activate", () => {
if (BrowserWindow.getAllWindows().length === 0) {
createWindow();
}
});