🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.
TypeScript agentagent-collaborationagent-harnessloop-engineeringmcppersonal-assistantproactive-agentskillssuper-agenttask-management
fix(desktop): use low urgency for Linux notifications to prevent GNOME Shell freeze (#13767)
Octopus7953cf5b5af3
diff --git a/apps/desktop/src/main/controllers/NotificationCtr.ts b/apps/desktop/src/main/controllers/NotificationCtr.tsindex 56d89cbbb21..e3a8bdfd7b1 100644--- a/apps/desktop/src/main/controllers/NotificationCtr.ts+++ b/apps/desktop/src/main/controllers/NotificationCtr.ts@@ -3,7 +3,7 @@ import type {ShowDesktopNotificationParams,} from '@lobechat/electron-client-ipc';import { app, Notification } from 'electron';-import { macOS, windows } from 'electron-is';+import { linux, macOS, windows } from 'electron-is';import { getIpcContext } from '@/utils/ipc';import { createLogger } from '@/utils/logger';@@ -131,7 +131,12 @@ export default class NotificationCtr extends ControllerModule {silent: params.silent || false,timeoutType: 'default',title: params.title,- urgency: 'normal',+ // On Linux/GNOME Shell, urgency 'normal' causes notifications to appear as banners.+ // Clicking the dismiss (X) button on such banners can freeze the system for 30-45 seconds+ // due to heavy gnome-shell processing. Using 'low' urgency routes notifications to the+ // message tray instead, preventing the banner's X button from being shown.+ // The urgency option is ignored on macOS and Windows.+ urgency: linux() ? 'low' : 'normal',});// Add more event listeners for debuggingdiff --git a/apps/desktop/src/main/controllers/__tests__/NotificationCtr.test.ts b/apps/desktop/src/main/controllers/__tests__/NotificationCtr.test.tsindex ee04e50873f..83ce25039b4 100644--- a/apps/desktop/src/main/controllers/__tests__/NotificationCtr.test.ts+++ b/apps/desktop/src/main/controllers/__tests__/NotificationCtr.test.ts@@ -41,6 +41,7 @@ vi.mock('electron', () => {// Mock electron-isvi.mock('electron-is', () => ({+ linux: vi.fn(() => false),macOS: vi.fn(() => false),windows: vi.fn(() => false),}));@@ -180,6 +181,26 @@ describe('NotificationCtr', () => {expect(result).toEqual({ success: true });});+ it('should use low urgency on Linux to prevent GNOME Shell freeze', async () => {+ const { linux } = await import('electron-is');+ const { Notification } = await import('electron');+ vi.mocked(linux).mockReturnValue(true);+ vi.mocked(Notification.isSupported).mockReturnValue(true);+ mockBrowserWindow.isVisible.mockReturnValue(false);++ const promise = controller.showDesktopNotification(params);+ vi.advanceTimersByTime(100);+ await promise;++ expect(Notification).toHaveBeenCalledWith(+ expect.objectContaining({+ urgency: 'low',+ }),+ );++ vi.mocked(linux).mockReturnValue(false);+ });+it('should show notification when window is minimized', async () => {const { Notification } = await import('electron');vi.mocked(Notification.isSupported).mockReturnValue(true);