-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.js
56 lines (47 loc) · 1.15 KB
/
main.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
const { app, BrowserWindow, ipcMain, Notification } = require('electron');
let mainWindow;
function createWindow() {
mainWindow = new BrowserWindow({
width: 1300,
height: 1650,
minWidth: 800,
minHeight: 600,
webPreferences: {
nodeIntegration: true,
contextIsolation: false,
enableRemoteModule: true
},
frame: false,
transparent: true,
titleBarStyle: 'hidden',
vibrancy: 'ultra-dark',
backgroundColor: '#00000000',
show: false
});
ipcMain.on('show-notification', (event, title, description) => {
const notification = new Notification({
title,
body: description,
icon: 'path/to/notification-icon.png' // Optional: set a custom icon for the notification
});
notification.show();
});
mainWindow.loadFile('index.html');
mainWindow.on('ready-to-show', () => {
mainWindow.show();
});
mainWindow.on('closed', () => {
mainWindow = null;
});
}
app.on('ready', createWindow);
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') {
app.quit();
}
});
app.on('activate', () => {
if (mainWindow === null) {
createWindow();
}
});