fix: Notification audio
All checks were successful
Queue Release Build / prepare (push) Successful in 16s
Deploy Web Apps / deploy (push) Successful in 11m55s
Queue Release Build / build-linux (push) Successful in 30m56s
Queue Release Build / build-windows (push) Successful in 27m50s
Queue Release Build / finalize (push) Successful in 2m0s

This commit is contained in:
2026-03-30 21:14:26 +02:00
parent 851d6ae759
commit 8b6578da3c
4 changed files with 17 additions and 5 deletions

View File

@@ -332,12 +332,15 @@ export function setupSystemHandlers(): void {
const title = typeof payload?.title === 'string' ? payload.title.trim() : '';
const body = typeof payload?.body === 'string' ? payload.body : '';
const mainWindow = getMainWindow();
const suppressSystemNotification = mainWindow?.isVisible() === true
&& !mainWindow.isMinimized()
&& mainWindow.isMaximized();
if (!title) {
return false;
}
if (Notification.isSupported()) {
if (!suppressSystemNotification && Notification.isSupported()) {
try {
const notification = new Notification({
title,

View File

@@ -203,6 +203,7 @@ Additional runtime guards:
The Electron main process handles the actual desktop notification and window-attention behavior.
- `show-desktop-notification` creates a system `Notification` with the window icon when supported.
- `show-desktop-notification` skips the OS toast while the main window is visible and maximized.
- Notification clicks restore, show, and focus the main window.
- `request-window-attention` flashes the taskbar entry directly when Electron is minimized or otherwise backgrounded and actionable unread exists.
- `show-desktop-notification` can still request attention for live toast delivery.
@@ -210,7 +211,7 @@ The Electron main process handles the actual desktop notification and window-att
### Platform-specific policy
- Windows: the facade also plays `AppSound.Notification` before showing the desktop notification.
- Windows: the facade only plays `AppSound.Notification` when the app is not the active selected window.
- Linux: desktop alerts are expected to surface through the system notification center, with window attention requested when the app is backgrounded.
- macOS and browser-only builds use the same desktop notification adapter, but there is no extra renderer-side sound policy in this domain.

View File

@@ -206,7 +206,7 @@ export class NotificationsFacade {
!context.isWindowFocused || !context.isDocumentVisible
);
if (this.platformKind === 'windows') {
if (this.shouldPlayNotificationSound()) {
this.audio.play(AppSound.Notification);
}
@@ -349,6 +349,14 @@ export class NotificationsFacade {
};
}
private shouldPlayNotificationSound(): boolean {
return this.platformKind === 'windows' && !this.isWindowActive();
}
private isWindowActive(): boolean {
return this._windowFocused() && this._documentVisible() && !this._windowMinimized();
}
private ensureRoomTracking(roomId: string, channelId: string, baselineTimestamp: number): void {
const settings = this._settings();

View File

@@ -11,8 +11,8 @@
<div class="min-w-0 flex-1">
<h4 class="text-base font-semibold text-foreground">Delivery</h4>
<p class="mt-1 text-sm text-muted-foreground">
Desktop alerts use the system notification center on Linux and request taskbar attention when the app is not focused. Windows also plays the
configured notification sound.
Desktop alerts use the system notification center on Linux and request taskbar attention when the app is not focused. Maximized app window
suppress system popups, and only play the configured notification sound while the app is in the background.
</p>
</div>
</div>