forked from conradoqg/naivecoin
-
Notifications
You must be signed in to change notification settings - Fork 3
/
main.js
60 lines (49 loc) · 1.49 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
const {app, Menu, BrowserWindow, shell, Tray, Notification} = require('electron')
const concord = require('./lib/concord')
let win
let tray = null
function createWindow () {
concord('::', 3001, [], 6, '1')
// tray = new Tray('concordLogoSmall.ico')
const contextMenu = Menu.buildFromTemplate([])
// tray.setToolTip('Concord Core')
// tray.setContextMenu(contextMenu)
// var mainMenu = new Menu()
Menu.setApplicationMenu(null)
const ipc = require('electron').ipcMain
win = new BrowserWindow({show: true, width: 810, height: 600, opacity: 0.97, minWidth: 810, minHeight: 600, backgroundColor: '#36393e', icon: 'img/concordLogoSmall.ico', frame: false})
ipc.on('invokeAction', function (event, data) {
event.sender.send('actionReply')
setTimeout(function () { app.quit() }, 100)
})
win.loadFile('index.html')
win.setThumbarButtons([])
app.setUserTasks([])
win.focus()
win.webContents.openDevTools() // This opens the developer console, comment/uncomment to enable/disable for now.
/* tray.on('click', () => {
win.isVisible() ? win.hide() : win.show()
})
win.on('show', () => {
tray.setHighlightMode('always')
})
win.on('hide', () => {
tray.setHighlightMode('never')
}) */
win.on('closed', () => {
win = null
})
}
app.on('ready', createWindow)
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') {
if (tray) {
tray.destroy()
}
}
})
app.on('activate', () => {
if (win === null) {
createWindow()
}
})