-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
35 lines (28 loc) · 856 Bytes
/
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
const { app, Tray, Menu, BrowserWindow } = require("electron");
const path = require("node:path");
if (require("electron-squirrel-startup")) {
app.quit();
}
app.whenReady().then(() => {
const platform = process.platform;
if (platform === "darwin") {
app.dock.hide();
}
const tray = new Tray(
path.join(
__dirname,
"images",
platform === "darwin" ? "iconTemplate.png" : platform === "win32" ? "icon.ico" : "icon.png"
)
);
tray.setToolTip("Battery Status");
tray.setContextMenu(Menu.buildFromTemplate([{ role: "quit", label: "Quit" }]));
const browserWindow = new BrowserWindow({
icon: path.join(__dirname, "images", "icon.png"),
show: false,
webPreferences: {
preload: path.join(__dirname, "preload.js"),
},
});
browserWindow.loadFile(path.join(__dirname, "index.html"));
});