From 6b1a48f2fb1778d4a54f11b64ceb1982023258cb Mon Sep 17 00:00:00 2001 From: Saoud Rizwan <7799382+saoudrizwan@users.noreply.github.com> Date: Wed, 18 Dec 2024 11:39:47 -0800 Subject: [PATCH] Add linux notifications --- src/integrations/notifications/index.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/integrations/notifications/index.ts b/src/integrations/notifications/index.ts index e11f37d34f..88fcc8726a 100644 --- a/src/integrations/notifications/index.ts +++ b/src/integrations/notifications/index.ts @@ -50,6 +50,19 @@ async function showWindowsNotification(options: NotificationOptions): Promise { + const { title = "", subtitle = "", message } = options + + // Combine subtitle and message if subtitle exists + const fullMessage = subtitle ? `${subtitle}\n${message}` : message + + try { + await execa("notify-send", [title, fullMessage]) + } catch (error) { + throw new Error(`Failed to show Linux notification: ${error}`) + } +} + export async function showSystemNotification(options: NotificationOptions): Promise { try { const { title = "Cline", message } = options @@ -65,6 +78,9 @@ export async function showSystemNotification(options: NotificationOptions): Prom case "win32": await showWindowsNotification({ ...options, title }) break + case "linux": + await showLinuxNotification({ ...options, title }) + break default: throw new Error("Unsupported platform") }