fixes #116 Add Unity launcher icons

This commit is contained in:
grunjol
2016-03-22 19:53:47 -03:00
parent cde0153019
commit a779f00ccb
6 changed files with 54 additions and 9 deletions

View File

@@ -27,8 +27,14 @@ function installDesktopFile () {
var desktopFile = fs.readFileSync(templatePath, 'utf8')
desktopFile = desktopFile.replace(/\$APP_NAME/g, config.APP_NAME)
desktopFile = desktopFile.replace(/\$APP_PATH/g, path.dirname(process.execPath))
desktopFile = desktopFile.replace(/\$EXEC_PATH/g, process.execPath)
var appPath = config.IS_PRODUCTION ? path.dirname(process.execPath) : config.ROOT_PATH
desktopFile = desktopFile.replace(/\$APP_PATH/g, appPath)
var execPath = process.execPath + (config.IS_PRODUCTION ? '' : ' \.')
desktopFile = desktopFile.replace(/\$EXEC_PATH/g, execPath)
desktopFile = desktopFile.replace(/\$TRY_EXEC_PATH/g, process.execPath)
var desktopFilePath = path.join(os.homedir(), '.local', 'share', 'applications', 'webtorrent.desktop')
fs.writeFileSync(desktopFilePath, desktopFile)

View File

@@ -57,9 +57,7 @@ function init () {
app.on('ipcReady', function () {
log('Command line args:', argv)
argv.forEach(function (torrentId) {
windows.main.send('dispatch', 'onOpen', torrentId)
})
processArgv(argv)
})
app.on('before-quit', function () {
@@ -104,9 +102,7 @@ function onAppOpen (newArgv) {
log('Second app instance opened, but was prevented:', newArgv)
windows.focusMainWindow()
newArgv.forEach(function (torrentId) {
windows.main.send('dispatch', 'onOpen', torrentId)
})
processArgv(newArgv)
} else {
argv.push(...newArgv)
}
@@ -116,6 +112,24 @@ function sliceArgv (argv) {
return argv.slice(config.IS_PRODUCTION ? 1 : 2)
}
function processArgv (argv) {
argv.forEach(function (argvi) {
switch (argvi) {
case '-n':
windows.main.send('dispatch', 'showCreateTorrent')
break
case '-o':
windows.main.send('dispatch', 'showOpenTorrentFile')
break
case '-u':
windows.main.send('showOpenTorrentAddress')
break
default:
windows.main.send('dispatch', 'onOpen', argvi)
}
})
}
function setupCrashReporter () {
// require('crash-reporter').start({
// productName: 'WebTorrent',

View File

@@ -27,6 +27,10 @@ function init () {
menu.showOpenTorrentFile()
})
ipcMain.on('showCreateTorrent', function (e) {
menu.showCreateTorrent()
})
ipcMain.on('setBounds', function (e, bounds, maximize) {
setBounds(bounds, maximize)
})

View File

@@ -4,6 +4,7 @@ module.exports = {
onWindowHide: onWindowHide,
onWindowShow: onWindowShow,
showOpenTorrentFile: showOpenTorrentFile,
showCreateTorrent: showCreateTorrent,
toggleFullScreen: toggleFullScreen
}