fixes #116 Add Unity launcher icons
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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',
|
||||
|
||||
@@ -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)
|
||||
})
|
||||
|
||||
@@ -4,6 +4,7 @@ module.exports = {
|
||||
onWindowHide: onWindowHide,
|
||||
onWindowShow: onWindowShow,
|
||||
showOpenTorrentFile: showOpenTorrentFile,
|
||||
showCreateTorrent: showCreateTorrent,
|
||||
toggleFullScreen: toggleFullScreen
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user