Draw attention to the window on new messages
// FREEBIE
This commit is contained in:
parent
ea930d53ae
commit
0c9cca08ba
3 changed files with 19 additions and 11 deletions
|
@ -13,16 +13,6 @@
|
||||||
return true;
|
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() {
|
window.clearAttention = function() {
|
||||||
console.log('clear attention');
|
console.log('clear attention');
|
||||||
if (window.keepClear) {
|
if (window.keepClear) {
|
||||||
|
|
16
main.js
16
main.js
|
@ -76,7 +76,11 @@ function createWindow () {
|
||||||
//sandbox: true,
|
//sandbox: true,
|
||||||
preload: path.join(__dirname, 'preload.js')
|
preload: path.join(__dirname, 'preload.js')
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
|
|
||||||
|
mainWindow.on('focus', function() {
|
||||||
|
mainWindow.flashFrame(false);
|
||||||
|
});
|
||||||
|
|
||||||
// Load locale
|
// Load locale
|
||||||
const locale = 'en'; // FIXME
|
const locale = 'en'; // FIXME
|
||||||
|
@ -177,3 +181,13 @@ app.on('activate', function () {
|
||||||
ipc.on('set-badge-count', function(event, count) {
|
ipc.on('set-badge-count', function(event, count) {
|
||||||
app.setBadgeCount(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);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
|
@ -11,6 +11,10 @@
|
||||||
window.setBadgeCount = function(count) {
|
window.setBadgeCount = function(count) {
|
||||||
ipc.send('set-badge-count', 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.
|
* Enables spell-checking and the right-click context menu in text editors.
|
||||||
* Electron (`webFrame.setSpellCheckProvider`) only underlines misspelled words;
|
* Electron (`webFrame.setSpellCheckProvider`) only underlines misspelled words;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue