Skip to content

Commit

Permalink
update build
Browse files Browse the repository at this point in the history
  • Loading branch information
PalmerAL committed Apr 28, 2016
1 parent 6b83107 commit 6258336
Showing 1 changed file with 29 additions and 2 deletions.
31 changes: 29 additions & 2 deletions main.build.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const browserPage = 'file://' + __dirname + '/index.html';

var mainWindow = null;
var isFocusMode = false;
var appIsReady = false;

function sendIPCToWindow(window, action, data) {
//if there are no windows, create a new one
Expand All @@ -24,6 +25,7 @@ function createWindow() {
'min-width': 320,
'min-height': 500,
'title-bar-style': 'hidden-inset',
'auto-hide-menu-bar': true,
icon: __dirname + '/icons/icon256.png',
});

Expand Down Expand Up @@ -87,6 +89,8 @@ app.on('window-all-closed', function () {
// This method will be called when Electron has finished
// initialization and is ready to create browser windows.
app.on('ready', function () {
appIsReady = true;

// Create the browser window.
electronScreen = electron.screen; //this module must be loaded after the app is ready

Expand All @@ -99,6 +103,22 @@ app.on('ready', function () {

});

app.on("open-url", function (e, url) {
if (appIsReady) {
sendIPCToWindow(mainWindow, "addTab", {
url: url
});
} else {
app.on("ready", function () {
setTimeout(function () { //TODO replace this with an event that occurs when the browserWindow finishes loading
sendIPCToWindow(mainWindow, "addTab", {
url: url
});
}, 750);
});
}
});


function createAppMenu() {
// create the menu. based on example from http://electron.atom.io/docs/v0.34.0/api/menu/
Expand All @@ -124,6 +144,13 @@ function createAppMenu() {
click: function (item, window) {
sendIPCToWindow(window, "addPrivateTab");
}
},
{
label: 'New Task',
accelerator: 'shift+CmdOrCtrl+n',
click: function (item, window) {
sendIPCToWindow(window, "addTask");
}
},
{
type: "separator"
Expand Down Expand Up @@ -243,8 +270,8 @@ function createAppMenu() {
label: 'Developer',
submenu: [
{
label: 'Reload',
accelerator: 'CmdOrCtrl+R',
label: 'Reload Browser',
accelerator: undefined,
click: function (item, focusedWindow) {
if (focusedWindow)
focusedWindow.reload();
Expand Down

0 comments on commit 6258336

Please sign in to comment.