element-hq / element-hq/element-web
The windows desktop client should not flash frame on noisy (loud) notification
- Dominant language
- TypeScript
- Stars
- 13.5k
- Forks
- 2.8k
- PR merge metrics
- PR metrics pending
Description
### The problem:

When receiving a noisy (loud) notification on the desktop client, the window is flashed using the [FlashWindow](https://www.electronjs.org/docs/tutorial/windows-taskbar#flash-frame) [API](https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-flashwindow). This makes the icon on the taskbar go orange and pops up the taskbar if it is normally automatically hidden. This is especially frustrating when it then hides something I'm looking at.
The typical function of the FlashWindow API is described in the remark on [MSDN](https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-flashwindow#remarks):
> Typically, a window is flashed to inform the user that the window requires attention but that it does not currently have the keyboard focus.
I want to argue that the window does not require immediate attention when receiving a message.
One could say that I should change the notification from noisy to on, but then the notification would not play a sound. Basically it's all or nothing.
### My solution:
Do not flash the window.
This is how the web client works and is in my opinion a much nicer way to handle notifications.
It is easily possible to change this by removing the `flashFrame` call from [this function](https://github.com/vector-im/element-desktop/blob/75b41d65c1290d59193153c211fb4e355e12af1f/src/electron-main.js#L321-L330):
```typescript
ipcMain.on('loudNotification', function() {
if (process.platform === 'win32' && mainWindow && !mainWindow.isFocused() && !focusHandlerAttached) {
mainWindow.flashFrame(true);
mainWindow.once('focus', () => {
mainWindow.flashFrame(false);
focusHandlerAttached = false;
});
focusHandlerAttached = true;
}
});
```
Another solution would be to add a setting to enable and disable this functionality. I do not like this, because 1) it is much harder to implement and 2) this is not in line with the different clients.
If someone has a better idea on how to handle this, please comment below.
Contributor guide
Assessment
This issue has not been assessed yet.