-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathmain.js
59 lines (52 loc) · 1.53 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
'use strict'
const electron = require('electron')
const app = electron.app
const globalShortcut = electron.globalShortcut
const os = require('os')
const path = require('path')
const config = require(path.join(__dirname, 'package.json'))
const BrowserWindow = electron.BrowserWindow
// const { autoUpdater } = require('electron-updater');
//app.SetName(config.productName)
var mainWindow = null
app.on('ready', function () {
mainWindow = new BrowserWindow({
backgroundColor: 'lightgray',
title: config.productName,
show: false,
center: true,
minWidth: 1000,
minHeight: 800,
height: 800,
width: 1000,
icon: path.join(__dirname, 'app', 'icon.ico'),
webPreferences: {
nodeIntegration: true,
defaultEncoding: 'UTF-8'
}
})
mainWindow.loadURL(`file://${__dirname}/app/index.html`)
// Enable keyboard shortcuts for Developer Tools on various platforms.
let platform = os.platform()
if (platform === 'darwin') {
globalShortcut.register('Command+Option+I', () => {
mainWindow.webContents.openDevTools()
})
} else if (platform === 'linux' || platform === 'win32') {
globalShortcut.register('Control+Shift+I', () => {
mainWindow.webContents.openDevTools()
})
}
mainWindow.once('ready-to-show', () => {
mainWindow.setMenu(null)
mainWindow.show()
})
mainWindow.onbeforeunload = (e) => {
//
// Prevent Command-R from unloading the window contents.
e.returnValue = false
}
mainWindow.on('closed', function () {
mainWindow = null
})
})