diff --git a/js/panel_controller.js b/js/panel_controller.js index 7ff4fd845943..8eb8bcb2a546 100644 --- a/js/panel_controller.js +++ b/js/panel_controller.js @@ -13,16 +13,6 @@ return true; }; - window.drawAttention = function() { - if (isOpen() && !isFocused()) { - if (window.keepClear) { - clearInterval(window.keepClear); - delete window.keepClear; - } - console.log('draw attention'); - extension.windows.drawAttention(inboxWindowId); - } - }; window.clearAttention = function() { console.log('clear attention'); if (window.keepClear) { diff --git a/main.js b/main.js index 75d2385004bc..2c795e673a03 100644 --- a/main.js +++ b/main.js @@ -76,7 +76,11 @@ function createWindow () { //sandbox: true, preload: path.join(__dirname, 'preload.js') } - }) + }); + + mainWindow.on('focus', function() { + mainWindow.flashFrame(false); + }); // Load locale const locale = 'en'; // FIXME @@ -177,3 +181,13 @@ app.on('activate', function () { ipc.on('set-badge-count', function(event, count) { app.setBadgeCount(count); }); +ipc.on('draw-attention', function(event, count) { + if (process.platform === 'darwin') { + app.dock.bounce(); + } else if (process.platform == 'win32') { + mainWindow.flashFrame(true); + setTimeout(function() { + mainWindow.flashFrame(false); + }, 1000); + } +}); diff --git a/preload.js b/preload.js index ce79ae6dbe8f..4d4cc0ea94d5 100644 --- a/preload.js +++ b/preload.js @@ -11,6 +11,10 @@ window.setBadgeCount = function(count) { ipc.send('set-badge-count', count); }; + window.drawAttention = function() { + console.log('draw attention'); + ipc.send('draw-attention'); + }; /** * Enables spell-checking and the right-click context menu in text editors. * Electron (`webFrame.setSpellCheckProvider`) only underlines misspelled words;