diff --git a/main/index.js b/main/index.js index 8b42f8f3..1c65833b 100644 --- a/main/index.js +++ b/main/index.js @@ -86,21 +86,24 @@ function update () { updateDockIcon() } +setInterval(function () { + updateThrottled() +}, 1000) + function updateDockIcon () { if (state.view.client) { var progress = state.view.client.progress + var activeTorrentsExist = state.view.client.torrents.some(function (torrent) { + return torrent.progress !== 1 + }) // Hide progress bar when client has no torrents, or progress is 100% - if (state.view.client.torrents.length === 0 || progress === 1) { + if (!activeTorrentsExist || progress === 1) { progress = -1 } electron.ipcRenderer.send('setProgress', progress) } } -setInterval(function () { - updateThrottled() -}, 1000) - function dispatch (action, ...args) { console.log('dispatch: %s %o', action, args) if (action === 'addTorrent') {