Skip to content

Commit

Permalink
Merge pull request #9 from ipfs/start-in-background
Browse files Browse the repository at this point in the history
add option to start/run in background
  • Loading branch information
jbenet committed Jun 13, 2015
2 parents 64c0607 + 2f8a3b1 commit eb520fe
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
13 changes: 9 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@ var ipfsd = require('ipfsd-ctl')
var multiaddr = require('multiaddr')
var Tray = require('tray')
var menu = require('menu')
var argv = require('minimist')(process.argv.slice(1))

var WEBUIPATH = '/webui'

var LOGO = __dirname + '/node_modules/ipfs-logo/ipfs-logo-256-ice.png'
var TRAY_ICON = (os.platform() !== 'darwin' ? LOGO
: __dirname + '/node_modules/ipfs-logo/platform-icons/osx-menu-bar.png')
Expand All @@ -18,9 +20,9 @@ var mainWindow = null
var mainTray = null

var wizard = function (err) {
var wizWindow = new BrowserWindow({icon: LOGO, width: 800, height: 600})
wizWindow.loadUrl('file://' + __dirname + '/wizard/wizard.html')
wizWindow.webContents.on('did-finish-load', function () {
mainWindow = new BrowserWindow({icon: LOGO, width: 800, height: 600})
mainWindow.loadUrl('file://' + __dirname + '/wizard/wizard.html')
mainWindow.webContents.on('did-finish-load', function () {
mainWindow.webContents.send('err', err.toString())
})
}
Expand Down Expand Up @@ -50,7 +52,10 @@ app.on('ready', function () {
ipfsd.local(function (err, ipfs) {
if (err) return wizard(err)

openWindow(ipfs)
// start in background?
if (!argv.b) {
openWindow(ipfs)
}

mainTray = new Tray(TRAY_ICON)
mainTray.setToolTip('IPFS')
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
"description": "Ipfs electron",
"main": "index.js",
"dependencies": {
"ipfs-logo": "0.1.3",
"ipfsd-ctl": "0.2.3",
"minimist": "^1.1.1",
"multiaddr": "0.1.2",
"silence-chromium": "2.0.0"
},
Expand All @@ -17,7 +19,6 @@
"electron-prebuilt": "0.26.1",
"shelljs": "0.4.0",
"rimraf": "2.3.4",
"ipfs-logo": "0.1.3",
"pre-commit": "1.0.6",
"standard": "3.3.2"
},
Expand Down

0 comments on commit eb520fe

Please sign in to comment.