From 11f78b28816125be127abb3be546b6296285d0d7 Mon Sep 17 00:00:00 2001 From: Feross Aboukhadijeh Date: Tue, 5 Apr 2016 18:26:27 -0700 Subject: [PATCH 1/4] Fix torrent name missing in done notification Fix #305 --- renderer/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/renderer/index.js b/renderer/index.js index 24541a5b..cd588594 100644 --- a/renderer/index.js +++ b/renderer/index.js @@ -642,7 +642,7 @@ function torrentDone (torrentKey, torrentInfo) { if (!state.window.isFocused) { state.dock.badge += 1 } - showDoneNotification(torrentKey) + showDoneNotification(torrentSummary) } update() From cf3b319fc7e19a9ab0fa87b8689ca82a82dc8a6f Mon Sep 17 00:00:00 2001 From: Feross Aboukhadijeh Date: Tue, 5 Apr 2016 18:33:48 -0700 Subject: [PATCH 2/4] Notification: Focus/unminimize/activate window on click Before, we would only focus, but not unminimize or show, etc. --- main/ipc.js | 4 ++++ renderer/index.js | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/main/ipc.js b/main/ipc.js index 8c76c987..99682719 100644 --- a/main/ipc.js +++ b/main/ipc.js @@ -70,6 +70,10 @@ function init () { shortcuts.unregisterPlayerShortcuts() }) + ipcMain.on('focusWindow', function (e, windowName) { + windows.focusWindow(windows[windowName]) + }) + // Capture all events var oldEmit = ipcMain.emit ipcMain.emit = function (name, e, ...args) { diff --git a/renderer/index.js b/renderer/index.js index cd588594..f4c88199 100644 --- a/renderer/index.js +++ b/renderer/index.js @@ -982,7 +982,7 @@ function showDoneNotification (torrent) { }) notif.onclick = function () { - window.focus() + ipcRenderer.send('focusWindow', 'main') } playInterfaceSound('DONE') From 2549307a7ece46a29f7138adfc4cbce572ddfa89 Mon Sep 17 00:00:00 2001 From: Feross Aboukhadijeh Date: Tue, 5 Apr 2016 18:34:09 -0700 Subject: [PATCH 3/4] style --- main/ipc.js | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/main/ipc.js b/main/ipc.js index 99682719..c9ef307d 100644 --- a/main/ipc.js +++ b/main/ipc.js @@ -79,16 +79,13 @@ function init () { ipcMain.emit = function (name, e, ...args) { // Relay messages between the main window and the WebTorrent hidden window if (name.startsWith('wt-')) { - var recipient, recipientStr if (e.sender.browserWindowOptions.title === 'webtorrent-hidden-window') { - recipient = windows.main - recipientStr = 'main' + windows.main.send(name, ...args) + log('webtorrent ipc: sent %s', name) } else { - recipient = windows.webtorrent - recipientStr = 'webtorrent' + windows.webtorrent.send(name, ...args) + log('webtorrent ipc: receieved %s', name) } - console.log('sending %s to %s', name, recipientStr) - recipient.send(name, ...args) return } From b3da0fc05cb1940ee2931a1c706694b538dab03f Mon Sep 17 00:00:00 2001 From: Feross Aboukhadijeh Date: Tue, 5 Apr 2016 18:34:30 -0700 Subject: [PATCH 4/4] show notifications even when window is focus --- renderer/index.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/renderer/index.js b/renderer/index.js index f4c88199..ed42b771 100644 --- a/renderer/index.js +++ b/renderer/index.js @@ -974,8 +974,6 @@ function onWarning (err) { } function showDoneNotification (torrent) { - if (state.window.isFocused) return - var notif = new window.Notification('Download Complete', { body: torrent.name, silent: true