@devries-cameron20 / t3code-1 / commits / 752acbf654
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

feat: add ability to create a new thread in the current project with shift+click and show shortcut in tooltip (#5994)

Co-authored-by: shivam <91240327+shivamhwp@users.noreply.github.com>

Utkarsh Patil committed Aug 11, 2026 at 18:26 UTC 752acbf6549e6dd422ac8d8ed11c0fa02577965b
3 files changed +74 -20
apps/web/src/components/Sidebar.logic.test.ts
+16
@@ -32,6 +32,7 @@ import {
32 sortThreadsForSidebar,
33 sortProjectsForSidebar,
34 sortScopedProjectsForSidebar,
35 + shouldCreateNewThreadInCurrentProject,
36 THREAD_JUMP_HINT_SHOW_DELAY_MS,
37 } from "./Sidebar.logic";
38 import {
@@ -410,6 +411,21 @@ describe("isTrailingDoubleClick", () => {
411 });
412 });
413
414 +describe("shouldCreateNewThreadInCurrentProject", () => {
415 + it("creates directly on shift+click in a multi-project setup", () => {
416 + expect(shouldCreateNewThreadInCurrentProject(true, 2)).toBe(true);
417 + });
418 +
419 + it("opens the picker on a plain click in a multi-project setup", () => {
420 + expect(shouldCreateNewThreadInCurrentProject(false, 2)).toBe(false);
421 + });
422 +
423 + it("creates directly on any click with a single project", () => {
424 + expect(shouldCreateNewThreadInCurrentProject(false, 1)).toBe(true);
425 + expect(shouldCreateNewThreadInCurrentProject(true, 1)).toBe(true);
426 + });
427 +});
428 +
429 describe("orderItemsByPreferredIds", () => {
430 it("keeps preferred ids first, skips stale ids, and preserves the relative order of remaining items", () => {
431 const ordered = orderItemsByPreferredIds({
apps/web/src/components/Sidebar.logic.ts
+11
@@ -274,6 +274,17 @@ export function isTrailingDoubleClick(detail: number): boolean {
274 return detail > 1;
275 }
276
277 +// Shift+click on the new thread button creates directly in the current
278 +// project, skipping the command palette's project picker. With a single
279 +// project there is nothing to pick, so a plain click already creates
280 +// immediately and the modifier changes nothing.
281 +export function shouldCreateNewThreadInCurrentProject(
282 + shiftKey: boolean,
283 + projectGroupCount: number,
284 +): boolean {
285 + return shiftKey || projectGroupCount <= 1;
286 +}
287 +
288 export function orderItemsByPreferredIds<TItem, TId>(input: {
289 items: readonly TItem[];
290 preferredIds: readonly TId[];
apps/web/src/components/Sidebar.tsx
+47 -20
@@ -131,6 +131,7 @@ import {
131 resolveSettledTimestamp,
132 resolveSidebarThreadStatus,
133 searchSidebarThreadsByTitle,
134 + shouldCreateNewThreadInCurrentProject,
135 resolveWorkingStartedAt,
136 sortLogicalProjectsForSidebar,
137 sortPinnedThreadsForSidebar,
@@ -3164,29 +3165,39 @@ export default function Sidebar() {
3165 // falling back to the top project) — same resolution the command palette
3166 // uses. The command palette already offers a "New thread in..." submenu
3167 // for multi-project setups.
3167 - const handleNewThreadClick = useCallback(() => {
3168 - // One project: nothing to pick, create immediately.
3169 - if (projectGroups.length <= 1) {
3168 + const handleNewThreadClick = useCallback(
3169 + (event?: ReactMouseEvent) => {
3170 + // One project: nothing to pick, create immediately. Shift+click creates
3171 + // directly in the current project even with several projects, skipping
3172 + // the palette picker.
3173 + if (shouldCreateNewThreadInCurrentProject(event?.shiftKey ?? false, projectGroups.length)) {
3174 + if (isMobile) setOpenMobile(false);
3175 + void startNewThreadFromContext({
3176 + activeDraftThread: newThreadContext.activeDraftThread,
3177 + activeThread: newThreadContext.activeThread ?? undefined,
3178 + defaultProjectRef: newThreadContext.defaultProjectRef,
3179 + handleNewThread: newThreadContext.handleNewThread,
3180 + });
3181 + return;
3182 + }
3183 if (isMobile) setOpenMobile(false);
3171 - void startNewThreadFromContext({
3172 - activeDraftThread: newThreadContext.activeDraftThread,
3173 - activeThread: newThreadContext.activeThread ?? undefined,
3174 - defaultProjectRef: newThreadContext.defaultProjectRef,
3175 - handleNewThread: newThreadContext.handleNewThread,
3176 - });
3177 - return;
3178 - }
3179 - if (isMobile) setOpenMobile(false);
3180 - openCommandPalette({ open: "new-thread-in" });
3181 - }, [isMobile, newThreadContext, projectGroups.length, setOpenMobile]);
3184 + openCommandPalette({ open: "new-thread-in" });
3185 + },
3186 + [isMobile, newThreadContext, projectGroups.length, setOpenMobile],
3187 + );
3188
3189 // The button mirrors chat.new: in multi-project setups both route through
3190 // the command palette's "New thread in..." picker, and in single-project
3185 - // setups both create immediately. chat.newLocal always creates directly, so
3186 - // it is only a correct label when chat.new is unbound.
3191 + // setups both create immediately. In multi-project setups the label is only
3192 + // the picker's shortcut: falling back to chat.newLocal would advertise the
3193 + // same shortcut for both the picker and direct create. In single-project
3194 + // setups both commands create directly, so chat.newLocal is a valid
3195 + // fallback. The second tooltip line (multi-project only) advertises
3196 + // shift+click and its keyboard twin chat.newLocal for direct create.
3197 const newThreadShortcutLabel =
3198 shortcutLabelForCommand(keybindings, "chat.new") ??
3189 - shortcutLabelForCommand(keybindings, "chat.newLocal");
3199 + (projectGroups.length <= 1 ? shortcutLabelForCommand(keybindings, "chat.newLocal") : undefined);
3200 + const newThreadInProjectShortcutLabel = shortcutLabelForCommand(keybindings, "chat.newLocal");
3201 return (
3202 <>
3203 <SidebarChromeHeader isElectron={isElectron} />
@@ -3264,9 +3275,25 @@ export default function Sidebar() {
3275 />
3276 </TooltipTrigger>
3277 <TooltipPopup side="right">
3267 - {newThreadShortcutLabel
3268 - ? `New thread (${newThreadShortcutLabel})`
3269 - : "New thread"}
3278 + {projectGroups.length > 1 ? (
3279 + <span className="flex flex-col gap-0.5">
3280 + <span>
3281 + {newThreadShortcutLabel
3282 + ? `New thread (${newThreadShortcutLabel})`
3283 + : "New thread"}
3284 + </span>
3285 + <span className="text-muted-foreground">
3286 + New thread in current project: Shift+click
3287 + {newThreadInProjectShortcutLabel
3288 + ? ` (${newThreadInProjectShortcutLabel})`
3289 + : ""}
3290 + </span>
3291 + </span>
3292 + ) : newThreadShortcutLabel ? (
3293 + `New thread (${newThreadShortcutLabel})`
3294 + ) : (
3295 + "New thread"
3296 + )}
3297 </TooltipPopup>
3298 </Tooltip>
3299 </div>