Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add option to start/run in background #9

Merged
merged 1 commit into from
Jun 13, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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