Browse Source

run app in electron window instead of browser

Paul Frazee 5 years ago
parent
commit
79eee8153a
1 changed files with 9 additions and 4 deletions
  1. 9
    4
      app/index.js

+ 9
- 4
app/index.js View File

@@ -2,24 +2,29 @@ var app = require('app')
2 2
 var Tray = require('tray')
3 3
 var Menu = require('menu')
4 4
 var shell = require('shell')
5
+var BrowserWindow = require('browser-window')
5 6
 var config = require('ssb-config') 
6 7
 
7 8
 // Report crashes to our server.
8 9
 //require('crash-reporter').start();
9 10
 
10 11
 var tray
12
+var mainWindow
11 13
 
12 14
 app.on('ready', function ready () {
13 15
   // start sbot
14 16
 	require('scuttlebot').init(config, function (err, sbot) {
15 17
     // open the web app
16
-    shell.openExternal('http://localhost:8008')
18
+    // shell.openExternal('http://localhost:8008')
19
+    mainWindow = new BrowserWindow({width: 1000, height: 720})
20
+    mainWindow.loadUrl('http://localhost:8008')
21
+    mainWindow.on('closed', function() { mainWindow = null })
17 22
 
18 23
     // setup menu
19 24
     Menu.setApplicationMenu(Menu.buildFromTemplate([{
20 25
       label: 'Window',
21 26
       submenu: [
22
-        { label: 'Open Web App', click: onopen },
27
+        // { label: 'Open Web App', click: onopen },
23 28
         { label: 'Quit', click: onquit }
24 29
       ]
25 30
     }]))
@@ -27,11 +32,11 @@ app.on('ready', function ready () {
27 32
     // setup tray icon
28 33
     tray = new Tray(__dirname+'/icon.png')
29 34
     tray.setContextMenu(Menu.buildFromTemplate([
30
-      { label: 'Open Web App', click: onopen },
35
+      // { label: 'Open Web App', click: onopen },
31 36
       { label: 'Quit', click: onquit }
32 37
     ]))
33 38
     tray.setToolTip('Secure Scuttlebutt: Running on port 8008')
34
-    tray.on('double-clicked', onopen)
39
+    // tray.on('double-clicked', onopen)
35 40
 
36 41
     // menu handlers
37 42
     function onopen () {

Loading…
Cancel
Save