forked from Infragistics/livewire
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
55 lines (42 loc) · 1.19 KB
/
index.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
/// <reference path="typings/node/node.d.ts"/>
var app = require('app');
var BrowserWindow = require('browser-window');
var globalShortcut = require('global-shortcut');
var mainWindow;
var shouldQuit = app.makeSingleInstance(function(commandLine, workingDirectory) {
// Someone tried to run a second instance, we should focus our window.
if (mainWindow) {
if (mainWindow.isMinimized()) mainWindow.restore();
mainWindow.focus();
}
return true;
});
if (shouldQuit) {
app.quit();
}
app.on('ready', function () {
mainWindow = new BrowserWindow({
width: 1000,
height: 800,
icon: __dirname + '/icon.png'
});
mainWindow.show();
//mainWindow.openDevTools();
mainWindow.loadURL('file://' + __dirname + '/app/index.html');
mainWindow.webContents.on('did-finish-load', function() {
if(process.platform.toLowerCase() === 'darwin'){
mainWindow.webContents.send('isMac', true);
}
});
globalShortcut.register('CmdOrCtrl+F12', function () {
mainWindow.show();
});
mainWindow.on('closed', function () {
mainWindow = null;
});
});
app.on('window-all-closed', function () {
if (process.platform.toLowerCase() != 'darwin') {
app.quit();
}
});