Draw attention to the window on new messages

// FREEBIE
This commit is contained in:
lilia 2017-04-24 17:14:38 -07:00 committed by Scott Nonnenberg
parent ea930d53ae
commit 0c9cca08ba
No known key found for this signature in database
GPG key ID: A4931C09644C654B
3 changed files with 19 additions and 11 deletions

16
main.js
View file

@ -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);
}
});