From 62583362efac59cdde07fffc194d4bb9912c91bb Mon Sep 17 00:00:00 2001 From: PalmerAL Date: Wed, 27 Apr 2016 23:46:28 -0500 Subject: [PATCH] update build --- main.build.js | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/main.build.js b/main.build.js index 4cfa8f07c..44c315551 100644 --- a/main.build.js +++ b/main.build.js @@ -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 @@ -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', }); @@ -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 @@ -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/ @@ -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" @@ -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();