From ae5eae5ec54758a1b40b8a89fc2048bcc71b8aee Mon Sep 17 00:00:00 2001 From: Douwe Osinga Date: Thu, 14 May 2026 12:26:31 -0400 Subject: [PATCH] feat(desktop): add goose://new-session deep link to open fresh chat (#9196) Signed-off-by: Douwe Osinga Co-authored-by: Douwe Osinga --- ui/desktop/src/main.ts | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/ui/desktop/src/main.ts b/ui/desktop/src/main.ts index 2717c3f009..343b5e1cda 100644 --- a/ui/desktop/src/main.ts +++ b/ui/desktop/src/main.ts @@ -410,6 +410,16 @@ if (process.platform !== 'darwin') { return; // Skip the rest of the handler } + // Handle new-session URL by creating a fresh chat window + if (parsedUrl.hostname === 'new-session') { + app.whenReady().then(async () => { + const recentDirs = loadRecentDirs(); + const openDir = recentDirs.length > 0 ? recentDirs[0] : null; + await createChat(app, { dir: openDir || undefined }); + }); + return; + } + // For non-bot URLs, continue with normal handling handleProtocolUrl(protocolUrl); } @@ -448,7 +458,11 @@ async function handleProtocolUrl(url: string) { const recentDirs = loadRecentDirs(); const openDir = recentDirs.length > 0 ? recentDirs[0] : null; - if (parsedUrl.hostname === 'bot' || parsedUrl.hostname === 'recipe') { + if (parsedUrl.hostname === 'new-session') { + await createChat(app, { dir: openDir || undefined }); + pendingDeepLink = null; + return; + } else if (parsedUrl.hostname === 'bot' || parsedUrl.hostname === 'recipe') { // For bot/recipe URLs, get existing window or create new one const existingWindows = BrowserWindow.getAllWindows(); const targetWindow = @@ -518,6 +532,14 @@ app.on('open-url', async (_event, url) => { const recentDirs = loadRecentDirs(); const openDir = recentDirs.length > 0 ? recentDirs[0] : null; + // Handle new-session URL by creating a fresh chat window + if (parsedUrl.hostname === 'new-session') { + log.info('[Main] Detected new-session URL, creating new chat window'); + openUrlHandledLaunch = true; + await createChat(app, { dir: openDir || undefined }); + return; + } + // Handle bot/recipe URLs by directly creating a new window if (parsedUrl.hostname === 'bot' || parsedUrl.hostname === 'recipe') { log.info('[Main] Detected bot/recipe URL, creating new chat window');