-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.js
35 lines (26 loc) · 858 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 mb = require('./src/menuBar.js').mb;
const config = require('./src/configuration.js').config;
const Keymap = require('./src/keymap.js');
const Clipboard = require('./src/clipboard.js');
const Tray = require('./src/tray.js');
const { ipcMain } = require('electron');
const AutoLaunch = require('auto-launch');
const DebugMode = require('electron-debug');
const PLATFORM_OSX = 'darwin';
const IPC_AUTOLAUNCH_EVENT = 'handle-autolaunch';
DebugMode({ showDevTools: true });
Keymap.init(mb);
Clipboard.init(mb);
Tray.init(mb, config);
// IPC Handlers
mb.on('after-create-window', () => {
ipcMain.on(IPC_AUTOLAUNCH_EVENT, (event, arg) => AutoLaunch.handle(mb, event, arg));
});
mb.on('after-create-window', () => {
mb.window.focus();
});
mb.app.on('window-all-closed', () => {
if (config.process !== PLATFORM_OSX) {
mb.app.quit();
}
});