-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
75 lines (67 loc) · 1.75 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
const { app, BrowserWindow, dialog, ipcMain, Tray } = require('electron')
const electron = require('electron')
const path = require('path')
const psnode = require('ps-node')
const IsDeveloperMode = false
function createWindow() {
const win = new BrowserWindow({
title: "A-90",
icon: "icon.png",
width: 1280,
height: 720,
center: true,
movable: false,
frame: false,
alwaysOnTop: true,
transparent: true,
webPreferences: {
devTools: IsDeveloperMode,
sandbox: false,
spellcheck: false,
preload: path.join(__dirname, 'preload.js')
}
})
win.loadFile('index.html')
win.maximize()
if (!IsDeveloperMode) win.removeMenu()
return win
}
let window = null
app.whenReady().then(() => {
window = createWindow()
app.___createdWindowForUse = window
app.setName('A-90')
app.setAppUserModelId('com.jeremygamer13.A90')
app.on('activate', () => {
if (BrowserWindow.getAllWindows().length === 0) {
window = createWindow()
app.___createdWindowForUse = window
}
})
})
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') {
app.quit()
}
})
ipcMain.handle("fullscreen", (_, __) => {
window.setFullScreen(true)
})
ipcMain.handle("quitApp", (_, __) => {
app.quit()
})
ipcMain.handle("started", (_, __) => {
window.setIgnoreMouseEvents(true)
})
ipcMain.handle("getMousePos", (_, __) => {
return electron.screen.getCursorScreenPoint()
})
ipcMain.handle("killProgram", (_, pid) => {
return new Promise((resolve, reject) => {
psnode.kill(pid, {
timeout: 1,
}, err => {
resolve(err)
})
})
})