From 2f00d63531a17a55d478111f338622258d4bbe3a Mon Sep 17 00:00:00 2001 From: StivenKN Date: Thu, 12 Nov 2026 12:23:35 +0000 Subject: [PATCH 1/3] feat(web): opt-in setting to start new threads in background Add the startNewThreadsInBackground client setting (off by default). With it on, a plain send from a new thread starts it in the background and keeps a fresh composer open, and the Start in Background binding opens the thread instead. composerDefaultSendIntent in composer-logic owns the rule. Co-Authored-By: Claude Opus 5.5 --- apps/web/src/components/chat/ChatComposer.tsx | 8 ++++ .../src/components/chat/composerCommandKey.ts | 10 ++++- .../components/settings/SettingsPanels.tsx | 41 ++++++++++++++++++- .../src/components/settings/settingsSearch.ts | 6 +++ apps/web/src/composer-logic.test.ts | 33 +++++++++++++++ apps/web/src/composer-logic.ts | 37 +++++++++++++---- docs/user/keybindings.md | 6 +++ packages/contracts/src/settings.ts | 4 ++ 8 files changed, 134 insertions(+), 11 deletions(-) diff --git a/apps/web/src/components/chat/ChatComposer.tsx b/apps/web/src/components/chat/ChatComposer.tsx index bafafcb9612c..2c3f1efaa6bb 100644 --- a/apps/web/src/components/chat/ChatComposer.tsx +++ b/apps/web/src/components/chat/ChatComposer.tsx @@ -73,6 +73,7 @@ import { type ComposerTrigger, type ComposerSubmissionIntent, collapseExpandedComposerCursor, + composerDefaultSendIntent, composerRequiresModifier, composerSubmissionIntentForKey, composerStateAtPromptEnd, @@ -2203,6 +2204,10 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps) ); }, }); + const defaultSendIntent = composerDefaultSendIntent({ + isDraftThread: routeKind === "draft", + startNewThreadsInBackground: settings.startNewThreadsInBackground, + }); const handleSubmitMessage = (event: React.MouseEvent) => { event.preventDefault(); submitComposer( @@ -2213,6 +2218,7 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps) activeTurnDefault: followUpBehavior, canSteer, }), + defaultSendIntent, ); }; const handleSubmitMessageStable = useStableCallback(handleSubmitMessage); @@ -2225,6 +2231,7 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps) activeTurnDefault: followUpBehavior, canSteer, }), + defaultSendIntent, ); }; const submitCitationAndSendStable = useStableCallback(submitCitationAndSend); @@ -2306,6 +2313,7 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps) phase, canSteer, followUpBehavior, + startNewThreadsInBackground: settings.startNewThreadsInBackground, isSoftwareKeyboardOpen, isLiteralPendingAnswer, pendingUserInputs, diff --git a/apps/web/src/components/chat/composerCommandKey.ts b/apps/web/src/components/chat/composerCommandKey.ts index 40650fe6c895..94445fc39ff5 100644 --- a/apps/web/src/components/chat/composerCommandKey.ts +++ b/apps/web/src/components/chat/composerCommandKey.ts @@ -14,6 +14,7 @@ import { type ComposerSubmissionIntent, type ComposerTrigger, collapseExpandedComposerCursor, + composerDefaultSendIntent, composerSubmissionIntentForKey, } from "../../composer-logic"; import { type PendingUserInput } from "../../session-logic"; @@ -40,6 +41,7 @@ export function composerCommandKeyHandler(input: { readonly phase: ChatComposerProps["phase"]; readonly canSteer: boolean; readonly followUpBehavior: ChatComposerProps["settings"]["followUpBehavior"]; + readonly startNewThreadsInBackground: ChatComposerProps["settings"]["startNewThreadsInBackground"]; readonly isSoftwareKeyboardOpen: boolean; readonly isLiteralPendingAnswer: boolean; readonly pendingUserInputs: ReadonlyArray; @@ -93,6 +95,7 @@ export function composerCommandKeyHandler(input: { phase, canSteer, followUpBehavior, + startNewThreadsInBackground, isSoftwareKeyboardOpen, isLiteralPendingAnswer, pendingUserInputs, @@ -208,6 +211,7 @@ export function composerCommandKeyHandler(input: { isRunning: phase === "running" || phase === "connecting", sendShortcut, prompt: promptRef.current, + startNewThreadsInBackground, }); if (key === "Tab" && event.shiftKey && submissionIntent === null) { return applyListEdit(event, listOutdentForTab); @@ -226,7 +230,11 @@ export function composerCommandKeyHandler(input: { composerMenuOpenRef.current = false; return true; } - if (menuIsActive && (submissionIntent === null || submissionIntent === "foreground")) { + const plainSendIntent = composerDefaultSendIntent({ + isDraftThread: routeKind === "draft", + startNewThreadsInBackground, + }); + if (menuIsActive && (submissionIntent === null || submissionIntent === plainSendIntent)) { const currentItems = composerMenuItemsRef.current; const selectedItem = activeComposerMenuItemRef.current ?? currentItems[0]; if (key === "ArrowDown" && currentItems.length > 0) { diff --git a/apps/web/src/components/settings/SettingsPanels.tsx b/apps/web/src/components/settings/SettingsPanels.tsx index 82d6a35df681..4a4e64f4a657 100644 --- a/apps/web/src/components/settings/SettingsPanels.tsx +++ b/apps/web/src/components/settings/SettingsPanels.tsx @@ -535,6 +535,10 @@ export function useSettingsRestore(onRestored?: () => void) { ...(settings.followUpBehavior !== DEFAULT_UNIFIED_SETTINGS.followUpBehavior ? ["Follow-up behavior"] : []), + ...(settings.startNewThreadsInBackground !== + DEFAULT_UNIFIED_SETTINGS.startNewThreadsInBackground + ? ["Start new threads in background"] + : []), ...(settings.toolCallVisibility !== DEFAULT_UNIFIED_SETTINGS.toolCallVisibility ? ["Tool calls in chat"] : []), @@ -659,6 +663,7 @@ export function useSettingsRestore(onRestored?: () => void) { composerRichTextEnabled: DEFAULT_UNIFIED_SETTINGS.composerRichTextEnabled, sendShortcut: DEFAULT_UNIFIED_SETTINGS.sendShortcut, followUpBehavior: DEFAULT_UNIFIED_SETTINGS.followUpBehavior, + startNewThreadsInBackground: DEFAULT_UNIFIED_SETTINGS.startNewThreadsInBackground, toolCallVisibility: DEFAULT_UNIFIED_SETTINGS.toolCallVisibility, screenReaderAnnouncements: DEFAULT_UNIFIED_SETTINGS.screenReaderAnnouncements, screenReaderWindowTitle: DEFAULT_UNIFIED_SETTINGS.screenReaderWindowTitle, @@ -1134,7 +1139,9 @@ export function GeneralSettingsPanel() { } export function ChatSettingsPanel() { - const modifierLabel = isMacPlatform(navigator.platform) ? "⌘" : "Ctrl"; + const isMac = isMacPlatform(navigator.platform); + const modifierLabel = isMac ? "⌘" : "Ctrl"; + const altLabel = isMac ? "Option" : "Alt"; const sendShortcutOptions = [ { value: "enter", label: "Enter" }, { value: "mod-enter-multiline", label: `${modifierLabel} + Enter for multiline prompts` }, @@ -1218,6 +1225,38 @@ export function ChatSettingsPanel() { } /> + + updateSettings({ + startNewThreadsInBackground: + DEFAULT_UNIFIED_SETTINGS.startNewThreadsInBackground, + }) + } + /> + ) : null + } + control={ + + updateSettings({ startNewThreadsInBackground: Boolean(checked) }) + } + aria-label="Start new threads in background" + /> + } + /> { }, ); + const ctrlEnter = { ...enter, ctrlKey: true }; + const ctrlAltEnter = { ...enter, ctrlKey: true, altKey: true }; + it.each([ + [true, "enter", "one line", true, enter, "background"], + [true, "enter", "one line", true, ctrlEnter, "foreground"], + [true, "enter", "one line", true, ctrlAltEnter, "foreground"], + [true, "enter", "one line", false, enter, "foreground"], + [true, "enter", "one line", false, ctrlAltEnter, "background"], + [true, "mod-enter", "one line", true, enter, null], + [true, "mod-enter", "one line", true, ctrlEnter, "background"], + [true, "mod-enter", "one line", true, ctrlAltEnter, "foreground"], + [true, "mod-enter-multiline", "two\nlines", true, ctrlEnter, "background"], + [true, "mod-enter-multiline", "two\nlines", true, ctrlAltEnter, "foreground"], + [true, "mod-enter-multiline", "one line", true, enter, "background"], + [true, "mod-enter-multiline", "one line", true, ctrlEnter, "foreground"], + [false, "mod-enter", "one line", true, ctrlEnter, "background"], + [false, "mod-enter", "one line", true, ctrlAltEnter, "background"], + ] as const)( + "resolves new-thread sends (in background %s, %s, %j, draft %s, %j)", + (startNewThreadsInBackground, sendShortcut, prompt, isDraftThread, event, expected) => { + expect( + composerSubmissionIntentForKey({ + ...input, + startNewThreadsInBackground, + sendShortcut, + prompt, + isDraftThread, + event, + }), + ).toBe(expected); + }, + ); + it.each(["MacIntel", "Win32", "Linux"])( "keeps modifier submission available with the software keyboard open on %s", (platform) => { diff --git a/apps/web/src/composer-logic.ts b/apps/web/src/composer-logic.ts index 37fef411897f..2187f7eaccad 100644 --- a/apps/web/src/composer-logic.ts +++ b/apps/web/src/composer-logic.ts @@ -20,6 +20,7 @@ import { resolveShortcutCommand, type ShortcutEventLike } from "./keybindings"; export type ComposerTriggerKind = "path" | "pull-request" | "slash-command" | "skill"; export type ComposerSlashCommand = "model" | "side" | "btw" | "clear"; export type ComposerSubmissionIntent = "foreground" | "background" | "alternate"; +export type ComposerSendIntent = Exclude; export interface ComposerTrigger { kind: ComposerTriggerKind; @@ -56,6 +57,14 @@ export function composerRequiresModifier( ); } +/** Intent for a plain send from this route: Enter and the send button. */ +export function composerDefaultSendIntent(input: { + isDraftThread: boolean; + startNewThreadsInBackground: boolean; +}): ComposerSendIntent { + return input.isDraftThread && input.startNewThreadsInBackground ? "background" : "foreground"; +} + export function composerSubmissionIntentForKey(input: { event: ShortcutEventLike & { isComposing?: boolean; keyCode?: number; repeat?: boolean }; keybindings: ResolvedKeybindingsConfig; @@ -65,31 +74,41 @@ export function composerSubmissionIntentForKey(input: { isRunning?: boolean; sendShortcut?: ClientSettings["sendShortcut"]; prompt?: string; + startNewThreadsInBackground?: boolean; }): ComposerSubmissionIntent | null { const { event } = input; if (event.isComposing || event.keyCode === 229 || event.repeat) return null; if (input.isSoftwareKeyboardOpen && event.key === "Enter" && !event.metaKey && !event.ctrlKey) return null; + const requiresModifier = composerRequiresModifier(input.sendShortcut, input.prompt ?? ""); const command = resolveShortcutCommand(event, input.keybindings, { ...(input.platform === undefined ? {} : { platform: input.platform }), context: { composerFocus: true, draftThreadRoute: input.isDraftThread, turnRunning: input.isRunning === true, - composerRequiresModifier: composerRequiresModifier(input.sendShortcut, input.prompt ?? ""), + composerRequiresModifier: requiresModifier, }, }); + const defaultIntent = composerDefaultSendIntent({ + isDraftThread: input.isDraftThread, + startNewThreadsInBackground: input.startNewThreadsInBackground === true, + }); if (command === "composer.sendAlternate" && input.isRunning) return "alternate"; - if (command === "composer.sendBackground" && input.isDraftThread) return "background"; + if (command === "composer.sendBackground" && input.isDraftThread) { + // A modifier send shortcut makes the send chord (Mod+Enter) hit this binding, and the send + // chord must still start in the background when the setting is on. + const isSendChord = + event.key === "Enter" && + !event.shiftKey && + !event.altKey && + requiresModifier === (event.metaKey || event.ctrlKey); + return isSendChord || defaultIntent === "foreground" ? "background" : "foreground"; + } if (command === "composer.sendAndNewThread" && !input.isDraftThread) return "background"; if (command !== null || event.key !== "Enter" || event.shiftKey || event.altKey) return null; - if ( - composerRequiresModifier(input.sendShortcut, input.prompt ?? "") && - !event.metaKey && - !event.ctrlKey - ) - return null; - return "foreground"; + if (requiresModifier && !event.metaKey && !event.ctrlKey) return null; + return defaultIntent; } function clampCursor(text: string, cursor: number): number { diff --git a/docs/user/keybindings.md b/docs/user/keybindings.md index 0449990ee0b2..407057cd0d0a 100644 --- a/docs/user/keybindings.md +++ b/docs/user/keybindings.md @@ -23,6 +23,12 @@ does the same. Change these shortcuts in **Settings → Keybindings** under or **Composer: Send and Start New Thread**. These bindings take priority over the send shortcut. Click the send button to use the configured follow-up behavior. +Turn on **Settings → Chat → Start new threads in background** to make sending +from a new thread start it in the background. `mod+Enter` or `mod+Alt+Enter` then +opens the thread instead. When your send shortcut requires `mod+Enter`, including +for a multiline prompt, `mod+Enter` starts the thread in the background, so use +`mod+Alt+Enter`. + When a thread has queued messages, `mod+Shift+Enter` sends the first one as a steer while a turn is running, or as a new turn when the thread is stopped. Change it under **Queue: Send First Queued Message** in Keybindings. diff --git a/packages/contracts/src/settings.ts b/packages/contracts/src/settings.ts index 2844c8181324..0dbb9c05e2e9 100644 --- a/packages/contracts/src/settings.ts +++ b/packages/contracts/src/settings.ts @@ -518,6 +518,9 @@ export const ClientSettingsSchema = Schema.Struct({ followUpBehavior: Schema.Literals(["queue", "steer"]).pipe( Schema.withDecodingDefault(Effect.succeed("steer")), ), + startNewThreadsInBackground: Schema.Boolean.pipe( + Schema.withDecodingDefault(Effect.succeed(false)), + ), proactivePanelsEnabled: Schema.Boolean.pipe(Schema.withDecodingDefault(Effect.succeed(false))), showSkillsInSlashMenu: Schema.Boolean.pipe(Schema.withDecodingDefault(Effect.succeed(true))), boringSidebarEnabled: Schema.Boolean.pipe(Schema.withDecodingDefault(Effect.succeed(false))), @@ -2049,6 +2052,7 @@ export const ClientSettingsPatch = Schema.Struct({ composerRichTextEnabled: Schema.optionalKey(Schema.Boolean), sendShortcut: Schema.optionalKey(Schema.Literals(["enter", "mod-enter-multiline", "mod-enter"])), followUpBehavior: Schema.optionalKey(Schema.Literals(["queue", "steer"])), + startNewThreadsInBackground: Schema.optionalKey(Schema.Boolean), proactivePanelsEnabled: Schema.optionalKey(Schema.Boolean), showSkillsInSlashMenu: Schema.optionalKey(Schema.Boolean), boringSidebarEnabled: Schema.optionalKey(Schema.Boolean), From d26aefecfc38b8b81be17ac53b1a0ff794367722 Mon Sep 17 00:00:00 2001 From: StivenKN Date: Thu, 12 Nov 2026 12:30:11 +0000 Subject: [PATCH 2/3] refactor(web): fit start-in-background to the shifted Start in Background chord Main now moves Start in Background to Mod+Shift+Enter when the send shortcut needs a modifier, so the send chord never reaches that binding and the special case for it goes away. submitComposer defaults the intent itself, which also covers form submit, the collapsed send button, and dictation. The setting lives on the new Chat settings page. --- apps/web/src/components/chat/ChatComposer.tsx | 14 ++++---- .../components/settings/SettingsPanels.tsx | 8 ++--- apps/web/src/composer-logic.test.ts | 36 +++++++++---------- apps/web/src/composer-logic.ts | 19 ++++------ docs/user/keybindings.md | 7 ++-- 5 files changed, 37 insertions(+), 47 deletions(-) diff --git a/apps/web/src/components/chat/ChatComposer.tsx b/apps/web/src/components/chat/ChatComposer.tsx index 2c3f1efaa6bb..e3cefcc1597d 100644 --- a/apps/web/src/components/chat/ChatComposer.tsx +++ b/apps/web/src/components/chat/ChatComposer.tsx @@ -2108,10 +2108,15 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps) const submitComposerRef = useRef< (dispatchMode?: ComposerDispatchMode, submissionIntent?: ComposerSubmissionIntent) => void >(() => {}); + const defaultSendIntent = composerDefaultSendIntent({ + isDraftThread: routeKind === "draft", + startNewThreadsInBackground: settings.startNewThreadsInBackground, + }); + // Callers that name no intent (send button, form submit, citation send) get the plain send. const submitComposer = ( event?: { preventDefault: () => void }, dispatchMode?: ComposerDispatchMode, - submissionIntent?: ComposerSubmissionIntent, + submissionIntent: ComposerSubmissionIntent = defaultSendIntent, ) => { if (voiceInputActive) { event?.preventDefault(); @@ -2188,6 +2193,7 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps) isRunning: phase === "running" || phase === "connecting", sendShortcut: settings.sendShortcut, prompt: promptRef.current, + startNewThreadsInBackground: settings.startNewThreadsInBackground, }); if (!intent) return; event.preventDefault(); @@ -2204,10 +2210,6 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps) ); }, }); - const defaultSendIntent = composerDefaultSendIntent({ - isDraftThread: routeKind === "draft", - startNewThreadsInBackground: settings.startNewThreadsInBackground, - }); const handleSubmitMessage = (event: React.MouseEvent) => { event.preventDefault(); submitComposer( @@ -2218,7 +2220,6 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps) activeTurnDefault: followUpBehavior, canSteer, }), - defaultSendIntent, ); }; const handleSubmitMessageStable = useStableCallback(handleSubmitMessage); @@ -2231,7 +2232,6 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps) activeTurnDefault: followUpBehavior, canSteer, }), - defaultSendIntent, ); }; const submitCitationAndSendStable = useStableCallback(submitCitationAndSend); diff --git a/apps/web/src/components/settings/SettingsPanels.tsx b/apps/web/src/components/settings/SettingsPanels.tsx index 4a4e64f4a657..112f221a568b 100644 --- a/apps/web/src/components/settings/SettingsPanels.tsx +++ b/apps/web/src/components/settings/SettingsPanels.tsx @@ -1139,9 +1139,7 @@ export function GeneralSettingsPanel() { } export function ChatSettingsPanel() { - const isMac = isMacPlatform(navigator.platform); - const modifierLabel = isMac ? "⌘" : "Ctrl"; - const altLabel = isMac ? "Option" : "Alt"; + const modifierLabel = isMacPlatform(navigator.platform) ? "⌘" : "Ctrl"; const sendShortcutOptions = [ { value: "enter", label: "Enter" }, { value: "mod-enter-multiline", label: `${modifierLabel} + Enter for multiline prompts` }, @@ -1230,8 +1228,8 @@ export function ChatSettingsPanel() { description={ "Sending from a new thread starts it in the background and keeps the new-thread composer open. " + (settings.sendShortcut === "mod-enter-multiline" - ? `Press ${modifierLabel} + Enter for single-line prompts or ${modifierLabel} + ${altLabel} + Enter for multiline prompts to open the thread instead.` - : `Press ${modifierLabel}${settings.sendShortcut === "mod-enter" ? ` + ${altLabel}` : ""} + Enter to open the thread instead.`) + ? `Press ${modifierLabel} + Enter for single-line prompts or ${modifierLabel} + Shift + Enter for multiline prompts to open the thread instead.` + : `Press ${modifierLabel}${settings.sendShortcut === "mod-enter" ? " + Shift" : ""} + Enter to open the thread instead.`) } resetAction={ settings.startNewThreadsInBackground !== diff --git a/apps/web/src/composer-logic.test.ts b/apps/web/src/composer-logic.test.ts index e7f694b39498..22f4b0e38772 100644 --- a/apps/web/src/composer-logic.test.ts +++ b/apps/web/src/composer-logic.test.ts @@ -223,29 +223,29 @@ describe("composerSubmissionIntentForKey", () => { ); const ctrlEnter = { ...enter, ctrlKey: true }; - const ctrlAltEnter = { ...enter, ctrlKey: true, altKey: true }; + const ctrlShiftEnter = { ...ctrlEnter, shiftKey: true }; + const ctrlAltEnter = { ...ctrlEnter, altKey: true }; it.each([ - [true, "enter", "one line", true, enter, "background"], - [true, "enter", "one line", true, ctrlEnter, "foreground"], - [true, "enter", "one line", true, ctrlAltEnter, "foreground"], - [true, "enter", "one line", false, enter, "foreground"], - [true, "enter", "one line", false, ctrlAltEnter, "background"], - [true, "mod-enter", "one line", true, enter, null], - [true, "mod-enter", "one line", true, ctrlEnter, "background"], - [true, "mod-enter", "one line", true, ctrlAltEnter, "foreground"], - [true, "mod-enter-multiline", "two\nlines", true, ctrlEnter, "background"], - [true, "mod-enter-multiline", "two\nlines", true, ctrlAltEnter, "foreground"], - [true, "mod-enter-multiline", "one line", true, enter, "background"], - [true, "mod-enter-multiline", "one line", true, ctrlEnter, "foreground"], - [false, "mod-enter", "one line", true, ctrlEnter, "background"], - [false, "mod-enter", "one line", true, ctrlAltEnter, "background"], + ["enter", "one line", true, enter, "background"], + ["enter", "one line", true, ctrlEnter, "foreground"], + ["enter", "one line", true, ctrlAltEnter, "foreground"], + ["enter", "one line", false, enter, "foreground"], + ["enter", "one line", false, ctrlAltEnter, "background"], + ["mod-enter", "one line", true, enter, null], + ["mod-enter", "one line", true, ctrlEnter, "background"], + ["mod-enter", "one line", true, ctrlShiftEnter, "foreground"], + ["mod-enter", "one line", true, ctrlAltEnter, "foreground"], + ["mod-enter-multiline", "two\nlines", true, ctrlEnter, "background"], + ["mod-enter-multiline", "two\nlines", true, ctrlShiftEnter, "foreground"], + ["mod-enter-multiline", "one line", true, enter, "background"], + ["mod-enter-multiline", "one line", true, ctrlEnter, "foreground"], ] as const)( - "resolves new-thread sends (in background %s, %s, %j, draft %s, %j)", - (startNewThreadsInBackground, sendShortcut, prompt, isDraftThread, event, expected) => { + "resolves sends with new threads starting in the background (%s, %j, draft %s, %j)", + (sendShortcut, prompt, isDraftThread, event, expected) => { expect( composerSubmissionIntentForKey({ ...input, - startNewThreadsInBackground, + startNewThreadsInBackground: true, sendShortcut, prompt, isDraftThread, diff --git a/apps/web/src/composer-logic.ts b/apps/web/src/composer-logic.ts index 2187f7eaccad..200d7a671136 100644 --- a/apps/web/src/composer-logic.ts +++ b/apps/web/src/composer-logic.ts @@ -20,7 +20,6 @@ import { resolveShortcutCommand, type ShortcutEventLike } from "./keybindings"; export type ComposerTriggerKind = "path" | "pull-request" | "slash-command" | "skill"; export type ComposerSlashCommand = "model" | "side" | "btw" | "clear"; export type ComposerSubmissionIntent = "foreground" | "background" | "alternate"; -export type ComposerSendIntent = Exclude; export interface ComposerTrigger { kind: ComposerTriggerKind; @@ -57,11 +56,11 @@ export function composerRequiresModifier( ); } -/** Intent for a plain send from this route: Enter and the send button. */ +/** Intent for a plain send from this route: the send shortcut, the send button, and dictation. */ export function composerDefaultSendIntent(input: { isDraftThread: boolean; startNewThreadsInBackground: boolean; -}): ComposerSendIntent { +}) { return input.isDraftThread && input.startNewThreadsInBackground ? "background" : "foreground"; } @@ -95,16 +94,10 @@ export function composerSubmissionIntentForKey(input: { startNewThreadsInBackground: input.startNewThreadsInBackground === true, }); if (command === "composer.sendAlternate" && input.isRunning) return "alternate"; - if (command === "composer.sendBackground" && input.isDraftThread) { - // A modifier send shortcut makes the send chord (Mod+Enter) hit this binding, and the send - // chord must still start in the background when the setting is on. - const isSendChord = - event.key === "Enter" && - !event.shiftKey && - !event.altKey && - requiresModifier === (event.metaKey || event.ctrlKey); - return isSendChord || defaultIntent === "foreground" ? "background" : "foreground"; - } + // Start in Background does the opposite of a plain send, so it opens the thread when plain + // sends already start in the background. + if (command === "composer.sendBackground" && input.isDraftThread) + return defaultIntent === "background" ? "foreground" : "background"; if (command === "composer.sendAndNewThread" && !input.isDraftThread) return "background"; if (command !== null || event.key !== "Enter" || event.shiftKey || event.altKey) return null; if (requiresModifier && !event.metaKey && !event.ctrlKey) return null; diff --git a/docs/user/keybindings.md b/docs/user/keybindings.md index 407057cd0d0a..7f523ddf747c 100644 --- a/docs/user/keybindings.md +++ b/docs/user/keybindings.md @@ -24,10 +24,9 @@ or **Composer: Send and Start New Thread**. These bindings take priority over th send shortcut. Click the send button to use the configured follow-up behavior. Turn on **Settings → Chat → Start new threads in background** to make sending -from a new thread start it in the background. `mod+Enter` or `mod+Alt+Enter` then -opens the thread instead. When your send shortcut requires `mod+Enter`, including -for a multiline prompt, `mod+Enter` starts the thread in the background, so use -`mod+Alt+Enter`. +from a new thread start it in the background. **Composer: Start in Background** +then opens the thread instead: `mod+Enter`, or `mod+Shift+Enter` when the send +shortcut requires `mod+Enter` for that prompt. When a thread has queued messages, `mod+Shift+Enter` sends the first one as a steer while a turn is running, or as a new turn when the thread is stopped. Change it under From e201e183f4b6ca63ba96d99953092971b0ad5dc1 Mon Sep 17 00:00:00 2001 From: StivenKN Date: Thu, 12 Nov 2026 12:42:20 +0000 Subject: [PATCH 3/3] docs: describe start-in-background in the thread guide and name every chord Also make the setting a required input of composerSubmissionIntentForKey so a new caller cannot silently skip it. --- apps/web/src/composer-logic.test.ts | 1 + apps/web/src/composer-logic.ts | 4 ++-- docs/user/keybindings.md | 11 ++++++----- docs/user/thread-sidebar.md | 5 +++++ 4 files changed, 14 insertions(+), 7 deletions(-) diff --git a/apps/web/src/composer-logic.test.ts b/apps/web/src/composer-logic.test.ts index 22f4b0e38772..fbd8ec7b40a1 100644 --- a/apps/web/src/composer-logic.test.ts +++ b/apps/web/src/composer-logic.test.ts @@ -100,6 +100,7 @@ describe("composerSubmissionIntentForKey", () => { platform: "Linux", isSoftwareKeyboardOpen: false, isDraftThread: false, + startNewThreadsInBackground: false, }; const enter = { key: "Enter", metaKey: false, ctrlKey: false, altKey: false, shiftKey: false }; diff --git a/apps/web/src/composer-logic.ts b/apps/web/src/composer-logic.ts index 200d7a671136..33ec49fd7add 100644 --- a/apps/web/src/composer-logic.ts +++ b/apps/web/src/composer-logic.ts @@ -73,7 +73,7 @@ export function composerSubmissionIntentForKey(input: { isRunning?: boolean; sendShortcut?: ClientSettings["sendShortcut"]; prompt?: string; - startNewThreadsInBackground?: boolean; + startNewThreadsInBackground: boolean; }): ComposerSubmissionIntent | null { const { event } = input; if (event.isComposing || event.keyCode === 229 || event.repeat) return null; @@ -91,7 +91,7 @@ export function composerSubmissionIntentForKey(input: { }); const defaultIntent = composerDefaultSendIntent({ isDraftThread: input.isDraftThread, - startNewThreadsInBackground: input.startNewThreadsInBackground === true, + startNewThreadsInBackground: input.startNewThreadsInBackground, }); if (command === "composer.sendAlternate" && input.isRunning) return "alternate"; // Start in Background does the opposite of a plain send, so it opens the thread when plain diff --git a/docs/user/keybindings.md b/docs/user/keybindings.md index 7f523ddf747c..d203032dadd6 100644 --- a/docs/user/keybindings.md +++ b/docs/user/keybindings.md @@ -18,15 +18,16 @@ inserts a new line. This applies to the web and desktop composer at desktop widt `mod+Enter` to do the opposite for one message, even when the send shortcut requires a modifier. `mod+Alt+Enter` sends, keeps that thread running in the background, and opens a fresh new-thread composer. In a new thread, `mod+Enter` -does the same. Change these shortcuts in **Settings → Keybindings** under +does the same (`mod+Shift+Enter` when the send shortcut requires `mod+Enter` for +that prompt). Change these shortcuts in **Settings → Keybindings** under **Composer: Opposite Queue or Steer Action**, **Composer: Start in Background**, or **Composer: Send and Start New Thread**. These bindings take priority over the send shortcut. Click the send button to use the configured follow-up behavior. -Turn on **Settings → Chat → Start new threads in background** to make sending -from a new thread start it in the background. **Composer: Start in Background** -then opens the thread instead: `mod+Enter`, or `mod+Shift+Enter` when the send -shortcut requires `mod+Enter` for that prompt. +With **Settings → Chat → Start new threads in background** on, sending from a new +thread starts it in the background, and **Composer: Start in Background** opens +the thread instead: `mod+Alt+Enter`, or `mod+Enter` (`mod+Shift+Enter` when the +send shortcut requires `mod+Enter` for that prompt). When a thread has queued messages, `mod+Shift+Enter` sends the first one as a steer while a turn is running, or as a new turn when the thread is stopped. Change it under diff --git a/docs/user/thread-sidebar.md b/docs/user/thread-sidebar.md index 09ce63e2a3e6..0b1f807e5e67 100644 --- a/docs/user/thread-sidebar.md +++ b/docs/user/thread-sidebar.md @@ -52,6 +52,11 @@ on Windows and Linux to start a new thread and immediately open another draft. T next draft keeps the workspace mode and base branch you selected. With **New worktree**, each background submission creates its own worktree. +To make this the default, turn on **Settings → Chat → Start new threads in +background**. Sending from a new thread then starts it in the background, and the +shortcut opens the thread instead. See [Keybindings](./keybindings.md#composer-controls) +for the chord under each send shortcut. + To send the same prompt to several models on web or desktop, **Shift-click** models in a new thread's model picker to add or remove them. A regular click returns to a single model. Choose a base branch and send. Each selection starts a separate thread