-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathapp.js
48 lines (40 loc) Β· 1.3 KB
/
app.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
const { app } = require('electron');
const path = require('path');
const { setScreenSize } = require('./src/config');
const MainWindow = require('./src/module/MainWindow');
const ApplicationTray = require('./src/module/ApplicationTray');
const { clipboard, code } = require('./src/service');
const { isDev } = require('./src/utils');
const WINDOW_URL = isDev()
? 'http://localhost:3000'
: `file://${__dirname}/client/build/index.html`;
const iconName =
process.platform === 'win32' ? 'windows-icon.png' : 'mac-icon.png';
const iconPath = path.join(__dirname, `src/assets/img/${iconName}`);
let mainWindow;
// eslint-disable-next-line no-unused-vars
let tray;
if (process.platform === 'darwin') {
app.dock.hide();
}
app.on('ready', () => {
setScreenSize();
mainWindow = new MainWindow(
{
height: 420,
width: 360,
frame: isDev() ? true : false,
resizable: isDev() ? true : false,
show: isDev() ? true : false,
webPreferences: {
devTools: isDev() ? true : false,
backgroundThrottling: false,
nodeIntegration: true,
},
},
WINDOW_URL
);
tray = new ApplicationTray(iconPath, mainWindow);
clipboard(mainWindow);
code(mainWindow);
});