2015-10-07 14:25:30 +02:00
|
|
|
var app = require('app'); // Module to control application life.
|
|
|
|
var BrowserWindow = require('browser-window'); // Module to create native browser window.
|
2015-10-13 20:44:55 +02:00
|
|
|
var Menu = require('menu');
|
2015-10-09 14:22:23 +02:00
|
|
|
var isDev = process.env.NODE_ENV === 'development';
|
2015-10-16 15:12:49 +02:00
|
|
|
var constants = require('./'+(isDev ? 'src': 'dist')+'/util/const');
|
2015-10-07 14:25:30 +02:00
|
|
|
|
|
|
|
var mainWindow = null;
|
|
|
|
|
|
|
|
// Quit when all windows are closed.
|
|
|
|
app.on('window-all-closed', function() {
|
|
|
|
app.quit();
|
|
|
|
});
|
|
|
|
|
|
|
|
app.on('ready', function() {
|
|
|
|
// Create the browser window.
|
|
|
|
var electronScreen = require('screen');
|
2015-10-16 15:12:49 +02:00
|
|
|
var size = electronScreen.getPrimaryDisplay().size;
|
2015-10-07 14:25:30 +02:00
|
|
|
|
2015-10-08 14:04:44 +02:00
|
|
|
var asDesktop = process.env.PITAYA_AS_DESKTOP == 1;
|
|
|
|
|
2015-10-07 14:25:30 +02:00
|
|
|
mainWindow = new BrowserWindow({
|
2015-10-08 14:04:44 +02:00
|
|
|
type: asDesktop ? 'desktop' : undefined,
|
|
|
|
'skip-taskbar': asDesktop,
|
|
|
|
frame: !asDesktop,
|
2015-10-10 14:34:14 +02:00
|
|
|
width: asDesktop ? size.width : undefined,
|
|
|
|
height: asDesktop ? size.height : undefined,
|
2015-10-13 20:44:55 +02:00
|
|
|
'auto-hide-menu-bar': true,
|
2015-10-10 14:34:14 +02:00
|
|
|
x: asDesktop ? 0 : undefined,
|
|
|
|
y: asDesktop ? 0 : undefined,
|
2015-10-07 14:25:30 +02:00
|
|
|
});
|
|
|
|
|
2015-10-16 15:12:49 +02:00
|
|
|
if(isDev) {
|
2015-10-07 14:25:30 +02:00
|
|
|
mainWindow.openDevTools();
|
|
|
|
}
|
|
|
|
|
|
|
|
// and load the index.html of the app.
|
|
|
|
mainWindow.loadUrl('file://' + __dirname + '/index.html');
|
|
|
|
|
|
|
|
mainWindow.on('closed', function() {
|
|
|
|
mainWindow = null;
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|