Skip to content

Commit 6258336

Browse files
committed
update build
1 parent 6b83107 commit 6258336

File tree

1 file changed

+29
-2
lines changed

1 file changed

+29
-2
lines changed

main.build.js

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ const browserPage = 'file://' + __dirname + '/index.html';
77

88
var mainWindow = null;
99
var isFocusMode = false;
10+
var appIsReady = false;
1011

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

@@ -87,6 +89,8 @@ app.on('window-all-closed', function () {
8789
// This method will be called when Electron has finished
8890
// initialization and is ready to create browser windows.
8991
app.on('ready', function () {
92+
appIsReady = true;
93+
9094
// Create the browser window.
9195
electronScreen = electron.screen; //this module must be loaded after the app is ready
9296

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

100104
});
101105

106+
app.on("open-url", function (e, url) {
107+
if (appIsReady) {
108+
sendIPCToWindow(mainWindow, "addTab", {
109+
url: url
110+
});
111+
} else {
112+
app.on("ready", function () {
113+
setTimeout(function () { //TODO replace this with an event that occurs when the browserWindow finishes loading
114+
sendIPCToWindow(mainWindow, "addTab", {
115+
url: url
116+
});
117+
}, 750);
118+
});
119+
}
120+
});
121+
102122

103123
function createAppMenu() {
104124
// create the menu. based on example from http://electron.atom.io/docs/v0.34.0/api/menu/
@@ -124,6 +144,13 @@ function createAppMenu() {
124144
click: function (item, window) {
125145
sendIPCToWindow(window, "addPrivateTab");
126146
}
147+
},
148+
{
149+
label: 'New Task',
150+
accelerator: 'shift+CmdOrCtrl+n',
151+
click: function (item, window) {
152+
sendIPCToWindow(window, "addTask");
153+
}
127154
},
128155
{
129156
type: "separator"
@@ -243,8 +270,8 @@ function createAppMenu() {
243270
label: 'Developer',
244271
submenu: [
245272
{
246-
label: 'Reload',
247-
accelerator: 'CmdOrCtrl+R',
273+
label: 'Reload Browser',
274+
accelerator: undefined,
248275
click: function (item, focusedWindow) {
249276
if (focusedWindow)
250277
focusedWindow.reload();

0 commit comments

Comments
 (0)