forked from amorist/platelet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.js
72 lines (59 loc) · 1.46 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
const { app, BrowserWindow, TouchBar } = require('electron')
const { TouchBarButton } = TouchBar
// require('update-electron-app')({
// repo: 'amorist/platelet',
// updateInterval: '1 hour',
// logger: require('electron-log')
// })
const spin = new TouchBarButton({
label: '👻 血小板 けっしょうばん',
backgroundColor: '#7851A9',
click: () => {
console.log('血小板')
}
})
const touchBar = new TouchBar([spin])
let mainWindow
function createWindow() {
mainWindow = new BrowserWindow({
width: 320,
height: 350,
title: 'platelet',
hasShadow: false,
transparent: true,
titleBarStyle: 'customButtonsOnHover',
resizable: app.isPackaged ? false : true,
frame: false,
focusable: true,
alwaysOnTop: true,
show: false
})
mainWindow.loadFile('index.html')
mainWindow.on('closed', () => mainWindow = null)
mainWindow.once('ready-to-show', () => {
mainWindow.show()
mainWindow.setTouchBar(touchBar)
})
}
app.on('ready', () => createWindow())
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') {
app.quit()
}
})
app.on('activate', () => {
if (mainWindow === null) {
createWindow()
}
})
app.on('second-instance', () => {
app.requestSingleInstanceLock()
})
if (process.platform === "darwin") {
app.setAboutPanelOptions({
applicationName: "血小板",
applicationVersion: app.getVersion(),
copyright: "Copyright 2018",
credits: "Amor"
});
}