diff --git a/src/integrations/notifications/index.ts b/src/integrations/notifications/index.ts index 8a26c1bf10..8d236b9142 100644 --- a/src/integrations/notifications/index.ts +++ b/src/integrations/notifications/index.ts @@ -1,10 +1,12 @@ import { execa } from "execa" import { platform } from "os" +import * as vscode from "vscode" interface NotificationOptions { title?: string subtitle?: string message: string + force?: boolean // Force notification even if the window is focused } async function showMacOSNotification(options: NotificationOptions): Promise { @@ -65,6 +67,11 @@ async function showLinuxNotification(options: NotificationOptions): Promise { try { + if (vscode.window.state.focused && !options.force) { + // If the window is focused, do not show a notification + return + } + const { title = "Roo Code", message } = options if (!message) { diff --git a/src/shared/WebviewMessage.ts b/src/shared/WebviewMessage.ts index eb6f4578f8..5723a042da 100644 --- a/src/shared/WebviewMessage.ts +++ b/src/shared/WebviewMessage.ts @@ -280,6 +280,7 @@ export interface WebviewMessage { title?: string subtitle?: string message: string + force?: boolean // Force notification even if the window is focused } } diff --git a/webview-ui/src/components/settings/NotificationSettings.tsx b/webview-ui/src/components/settings/NotificationSettings.tsx index 3fe1bad616..668775a788 100644 --- a/webview-ui/src/components/settings/NotificationSettings.tsx +++ b/webview-ui/src/components/settings/NotificationSettings.tsx @@ -39,6 +39,7 @@ export const NotificationSettings = ({ notificationOptions: { title: t("settings.notifications.system.testTitle"), message: t("settings.notifications.system.testMessage"), + force: true, }, }) }