diff --git a/renderer/index.js b/renderer/index.js index 112f3381..3e4e3afb 100644 --- a/renderer/index.js +++ b/renderer/index.js @@ -400,6 +400,7 @@ function addTorrentEvents (torrent) { state.dock.badge += 1 } + showDoneNotification(torrent) update() } } @@ -571,3 +572,16 @@ function onError (err) { function onWarning (err) { console.log('warning: %s', err.message) } + +function showDoneNotification (torrent) { + console.log(state.window.isFocused) + if (state.window.isFocused) return + + var notif = new window.Notification('Download Complete', { + body: torrent.name + }) + + notif.onclick = function () { + window.focus() + } +}