fixes #116 Add Unity launcher icons
This commit is contained in:
@@ -27,8 +27,14 @@ function installDesktopFile () {
|
|||||||
var desktopFile = fs.readFileSync(templatePath, 'utf8')
|
var desktopFile = fs.readFileSync(templatePath, 'utf8')
|
||||||
|
|
||||||
desktopFile = desktopFile.replace(/\$APP_NAME/g, config.APP_NAME)
|
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')
|
var desktopFilePath = path.join(os.homedir(), '.local', 'share', 'applications', 'webtorrent.desktop')
|
||||||
fs.writeFileSync(desktopFilePath, desktopFile)
|
fs.writeFileSync(desktopFilePath, desktopFile)
|
||||||
|
|||||||
@@ -57,9 +57,7 @@ function init () {
|
|||||||
|
|
||||||
app.on('ipcReady', function () {
|
app.on('ipcReady', function () {
|
||||||
log('Command line args:', argv)
|
log('Command line args:', argv)
|
||||||
argv.forEach(function (torrentId) {
|
processArgv(argv)
|
||||||
windows.main.send('dispatch', 'onOpen', torrentId)
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
|
|
||||||
app.on('before-quit', function () {
|
app.on('before-quit', function () {
|
||||||
@@ -104,9 +102,7 @@ function onAppOpen (newArgv) {
|
|||||||
log('Second app instance opened, but was prevented:', newArgv)
|
log('Second app instance opened, but was prevented:', newArgv)
|
||||||
windows.focusMainWindow()
|
windows.focusMainWindow()
|
||||||
|
|
||||||
newArgv.forEach(function (torrentId) {
|
processArgv(newArgv)
|
||||||
windows.main.send('dispatch', 'onOpen', torrentId)
|
|
||||||
})
|
|
||||||
} else {
|
} else {
|
||||||
argv.push(...newArgv)
|
argv.push(...newArgv)
|
||||||
}
|
}
|
||||||
@@ -116,6 +112,24 @@ function sliceArgv (argv) {
|
|||||||
return argv.slice(config.IS_PRODUCTION ? 1 : 2)
|
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 () {
|
function setupCrashReporter () {
|
||||||
// require('crash-reporter').start({
|
// require('crash-reporter').start({
|
||||||
// productName: 'WebTorrent',
|
// productName: 'WebTorrent',
|
||||||
|
|||||||
@@ -27,6 +27,10 @@ function init () {
|
|||||||
menu.showOpenTorrentFile()
|
menu.showOpenTorrentFile()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
ipcMain.on('showCreateTorrent', function (e) {
|
||||||
|
menu.showCreateTorrent()
|
||||||
|
})
|
||||||
|
|
||||||
ipcMain.on('setBounds', function (e, bounds, maximize) {
|
ipcMain.on('setBounds', function (e, bounds, maximize) {
|
||||||
setBounds(bounds, maximize)
|
setBounds(bounds, maximize)
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ module.exports = {
|
|||||||
onWindowHide: onWindowHide,
|
onWindowHide: onWindowHide,
|
||||||
onWindowShow: onWindowShow,
|
onWindowShow: onWindowShow,
|
||||||
showOpenTorrentFile: showOpenTorrentFile,
|
showOpenTorrentFile: showOpenTorrentFile,
|
||||||
|
showCreateTorrent: showCreateTorrent,
|
||||||
toggleFullScreen: toggleFullScreen
|
toggleFullScreen: toggleFullScreen
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -173,6 +173,9 @@ function dispatch (action, ...args) {
|
|||||||
if (action === 'addTorrent') {
|
if (action === 'addTorrent') {
|
||||||
addTorrent(args[0] /* torrent */)
|
addTorrent(args[0] /* torrent */)
|
||||||
}
|
}
|
||||||
|
if (action === 'showCreateTorrent') {
|
||||||
|
ipcRenderer.send('showCreateTorrent')
|
||||||
|
}
|
||||||
if (action === 'showOpenTorrentFile') {
|
if (action === 'showOpenTorrentFile') {
|
||||||
ipcRenderer.send('showOpenTorrentFile')
|
ipcRenderer.send('showOpenTorrentFile')
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,24 @@ Icon=webtorrent
|
|||||||
Terminal=false
|
Terminal=false
|
||||||
Path=$APP_PATH
|
Path=$APP_PATH
|
||||||
Exec=$EXEC_PATH %U
|
Exec=$EXEC_PATH %U
|
||||||
TryExec=$EXEC_PATH
|
TryExec=$TRY_EXEC_PATH
|
||||||
StartupNotify=false
|
StartupNotify=false
|
||||||
Categories=Network;FileTransfer;P2P;
|
Categories=Network;FileTransfer;P2P;
|
||||||
MimeType=application/x-bittorrent;x-scheme-handler/magnet;
|
MimeType=application/x-bittorrent;x-scheme-handler/magnet;
|
||||||
|
|
||||||
|
Actions=CreateNewTorrent;OpenTorrentFile;OpenTorrentAddress;
|
||||||
|
|
||||||
|
[Desktop Action CreateNewTorrent]
|
||||||
|
Name=Create New Torrent...
|
||||||
|
Exec=$EXEC_PATH -n
|
||||||
|
Path=$APP_PATH
|
||||||
|
|
||||||
|
[Desktop Action OpenTorrentFile]
|
||||||
|
Name=Open Torrent File...
|
||||||
|
Exec=$EXEC_PATH -o
|
||||||
|
Path=$APP_PATH
|
||||||
|
|
||||||
|
[Desktop Action OpenTorrentAddress]
|
||||||
|
Name=Open Torrent Address...
|
||||||
|
Exec=$EXEC_PATH -u
|
||||||
|
Path=$APP_PATH
|
||||||
|
|||||||
Reference in New Issue
Block a user