Skip to content

Commit 33ee42f

Browse files
committed
use loudNotification for flashFrame, resetting on count=0 or focus
win32 check is optional just there so we're not attaching pointless handlers Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
1 parent 0e742ce commit 33ee42f

2 files changed

Lines changed: 16 additions & 12 deletions

File tree

‎electron_app/src/electron-main.js‎

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -119,19 +119,19 @@ electron.ipcMain.on('install_update', installUpdate);
119119
let focusHandlerAttached = false;
120120
electron.ipcMain.on('setBadgeCount', function(ev, count) {
121121
electron.app.setBadgeCount(count);
122-
if (process.platform === 'win32' && mainWindow && !mainWindow.isFocused()) {
123-
if (count > 0) {
124-
if (!focusHandlerAttached) {
125-
mainWindow.once('focus', () => {
126-
mainWindow.flashFrame(false);
127-
focusHandlerAttached = false;
128-
});
129-
focusHandlerAttached = true;
130-
}
131-
mainWindow.flashFrame(true);
132-
} else {
122+
if (count === 0) {
123+
mainWindow.flashFrame(false);
124+
}
125+
});
126+
127+
electron.ipcMain.on('loudNotification', function() {
128+
if (process.platform === 'win32' && mainWindow && !mainWindow.isFocused() && !focusHandlerAttached) {
129+
mainWindow.flashFrame(true);
130+
mainWindow.once('focus', () => {
133131
mainWindow.flashFrame(false);
134-
}
132+
focusHandlerAttached = false;
133+
});
134+
focusHandlerAttached = true;
135135
}
136136
});
137137

‎src/vector/platform/ElectronPlatform.js‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,10 @@ export default class ElectronPlatform extends VectorBasePlatform {
124124
return notification;
125125
}
126126

127+
loudNotification(ev: Event, room: Object) {
128+
ipcRenderer.send('loudNotification');
129+
}
130+
127131
clearNotification(notif: Notification) {
128132
notif.close();
129133
}

0 commit comments

Comments
 (0)