diff --git a/main/ipc.js b/main/ipc.js index b2d0295a..493fb4b4 100644 --- a/main/ipc.js +++ b/main/ipc.js @@ -93,6 +93,13 @@ function init () { windows.focusWindow(windows[windowName]) }) + ipcMain.on('downloadFinished', function (e, filePath) { + if (app.dock) { + // Bounces the Downloads stack if the filePath is inside the Downloads folder. + app.dock.downloadFinished(filePath) + } + }) + ipcMain.on('checkForVLC', function (e) { vlc.checkForVLC(function (isInstalled) { windows.main.send('checkForVLC', isInstalled) diff --git a/renderer/index.js b/renderer/index.js index c0f0d18e..90ee2877 100644 --- a/renderer/index.js +++ b/renderer/index.js @@ -773,6 +773,7 @@ function torrentDone (torrentKey, torrentInfo) { state.dock.badge += 1 } showDoneNotification(torrentSummary) + ipcRenderer.send('downloadFinished', getTorrentPath(torrentSummary)) } update() @@ -1018,12 +1019,16 @@ function openTorrentContextMenu (infoHash) { menu.popup(electron.remote.getCurrentWindow()) } -function showItemInFolder (torrentSummary) { +function getTorrentPath (torrentSummary) { var itemPath = path.join(torrentSummary.path, torrentSummary.files[0].path) if (torrentSummary.files.length > 1) { itemPath = path.dirname(itemPath) } - ipcRenderer.send('showItemInFolder', itemPath) + return itemPath +} + +function showItemInFolder (torrentSummary) { + ipcRenderer.send('showItemInFolder', getTorrentPath(torrentSummary)) } function saveTorrentFileAs (torrentSummary) {