-
Notifications
You must be signed in to change notification settings - Fork 6
/
main.js
54 lines (44 loc) · 1.27 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
/* Requires */
var app = require('app');
var Menu = require('menu');
var Tray = require('tray');
var path = require('path');
var BrowserWindow = require('browser-window');
require('crash-reporter').start();
require('electron-debug')();
/* Variables */
var appIcon = null;
var mainWindow = null;
var iconPath = path.join(__dirname, '/public/img/logo.png');
/* Internal */
app.on('window-all-closed', function() {
if(process.platform !== 'darwin') {
app.quit();
}
});
app.on('ready', function() {
mainWindow = new BrowserWindow({
show: false,
width: 1400,
height: 658,
center: true,
title: 'Unsplashify',
icon: __dirname + '/public/img/logo.png'
});
mainWindow.loadUrl('file://' + __dirname + '/index.html');
mainWindow.setMenu(null);
mainWindow.webContents.on('did-finish-load', function() {
mainWindow.setMinimumSize(800, 400);
mainWindow.show();
mainWindow.focus();
appIcon = new Tray(iconPath);
var contextMenu = Menu.buildFromTemplate([{
label: 'Electron'
}]);
appIcon.setToolTip('This is my application.');
appIcon.setContextMenu(contextMenu);
});
mainWindow.on('closed', function() {
mainWindow = null;
});
});