Skip to content

Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.

feat(agentic-ide): move the grid / threads switch to the middle of the window caption

rubenluetke10-beep59f1b3532dbb
diff --git a/jarvis/ui/web/frontend/src/components/agentic/IdeProjectTree.tsx b/jarvis/ui/web/frontend/src/components/agentic/IdeProjectTree.tsx
index 831c55b591..127c3a99bd 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/IdeProjectTree.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentic/IdeProjectTree.tsx
@@ -7,7 +7,6 @@ import { useComputerChoices } from "@/hooks/useComputers";
import { addTerminal, fetchWorkspacePanes, interruptTerminal, placeWorkspace, removeWorkspace, renameWorkspace, startIdeSession, IdeApiError, reorderWorkspaces, type IdeProject, type ProjectWorkspace, type WorkspacePaneRow } from "@/lib/agenticIdeApi";
import { useEventStore } from "@/store/events";
import { useIdeProjectsStore } from "@/store/ideProjects";
-import { IdeLayoutSwitch } from "./threads/IdeLayoutSwitch";
const EXPANSION_KEY = "jarvis.ide.projectExpansion.v1";
const WORKSPACE_DRAG_MIME = "application/x-jarvis-workspace-id";
@@ -780,7 +779,6 @@ export function IdeProjectTree() {
<div className="flex h-8 items-center justify-between pl-2 pr-1 text-[15px] font-semibold text-foreground">
<span>Workspaces</span>
<div className="flex items-center gap-0.5">
- <IdeLayoutSwitch />
<button type="button" aria-label="Jarvis Live" title="Jarvis Live" onClick={toggleVoice}
className="rounded-md p-1.5 text-muted-foreground hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"><Mic className="h-3.5 w-3.5" /></button>
<button type="button" aria-label="Connect project" title="Connect project folder" onClick={connectProject}
diff --git a/jarvis/ui/web/frontend/src/components/agentic/threads/IdeLayoutSwitch.tsx b/jarvis/ui/web/frontend/src/components/agentic/threads/IdeLayoutSwitch.tsx
index c4527e7f57..046cd15149 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/threads/IdeLayoutSwitch.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentic/threads/IdeLayoutSwitch.tsx
@@ -7,23 +7,33 @@ const CHOICES: { layout: IdeLayout; label: string; Icon: typeof LayoutGrid }[] =
{ layout: "threads", label: "Threads", Icon: MessagesSquare },
];
+/** Width of one segment; the sliding thumb moves by exactly this much. */
+const SEGMENT_PX = 40;
+
/**
- * Grid or threads — the two ways the Agentic IDE is laid out. Two buttons,
- * not one that cycles, so each says where it leads; the one that is on wears
- * the lift surface.
+ * Grid or threads — the two ways the Agentic IDE is laid out. Sits in the
+ * middle of the window caption: a rounded track with one thumb that slides
+ * under the layout that is on. Two buttons rather than one that cycles, so
+ * each says where it leads.
*/
-export function IdeLayoutSwitch() {
+export function IdeLayoutSwitch({ className }: { className?: string }) {
const layout = useIdeThreadsStore((state) => state.layout);
const setLayout = useIdeThreadsStore((state) => state.setLayout);
- return <div role="group" aria-label="IDE layout" className="flex items-center gap-0.5 rounded-md bg-secondary/60 p-0.5">
- {CHOICES.map(({ layout: choice, label, Icon }) => <button key={choice} type="button"
- data-testid={`ide-layout-${choice}`} aria-pressed={layout === choice} aria-label={label} title={label}
+ const index = Math.max(0, CHOICES.findIndex((choice) => choice.layout === layout));
+ return <div role="radiogroup" aria-label="IDE layout" data-testid="ide-layout-switch"
+ className={cn("relative flex h-7 items-center rounded-full border border-border bg-secondary/70 p-[3px] shadow-rim dark:bg-card", className)}>
+ <span aria-hidden
+ style={{ width: SEGMENT_PX, transform: `translateX(${index * SEGMENT_PX}px)` }}
+ className="absolute inset-y-[3px] left-[3px] rounded-full border border-border-strong/60 bg-background shadow-[0_1px_2px_rgb(var(--scrim-rgb)/0.25)] dark:border-border-strong dark:bg-surface-raised transition-transform duration-200 ease-out motion-reduce:transition-none" />
+ {CHOICES.map(({ layout: choice, label, Icon }) => <button key={choice} type="button" role="radio"
+ data-testid={`ide-layout-${choice}`} aria-checked={layout === choice} aria-label={label} title={label}
onClick={() => setLayout(choice)}
+ style={{ width: SEGMENT_PX }}
className={cn(
- "flex h-6 w-6 items-center justify-center rounded text-muted-foreground transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
- layout === choice && "bg-background text-foreground shadow-rim",
+ "relative z-[1] flex h-full items-center justify-center rounded-full transition-colors duration-150 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
+ layout === choice ? "text-foreground-strong" : "text-muted-foreground hover:text-foreground",
)}>
- <Icon aria-hidden className="h-3.5 w-3.5" />
+ <Icon aria-hidden className="h-4 w-4" strokeWidth={1.9} />
</button>)}
</div>;
}
diff --git a/jarvis/ui/web/frontend/src/components/agentic/threads/ThreadTree.tsx b/jarvis/ui/web/frontend/src/components/agentic/threads/ThreadTree.tsx
index 0d3c166602..c6e14dcfd0 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/threads/ThreadTree.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentic/threads/ThreadTree.tsx
@@ -7,7 +7,6 @@ import { cn } from "@/lib/utils";
import { useEventStore } from "@/store/events";
import { useIdeProjectsStore } from "@/store/ideProjects";
import { useIdeThreadsStore } from "@/store/ideThreads";
-import { IdeLayoutSwitch } from "./IdeLayoutSwitch";
import { ThreadMenuItem, ThreadMenuSeparator, ThreadPopover } from "./ThreadPopover";
import { shortAge, threadStatus, threadTitle, threadsByProject, useThreadChatStore, type ThreadStatus } from "./threadModel";
@@ -233,7 +232,6 @@ export function ThreadTree() {
<div className="flex h-8 items-center justify-between gap-2 pl-2 pr-1 text-[15px] font-semibold text-foreground">
<span>Threads</span>
<div className="flex items-center gap-1">
- <IdeLayoutSwitch />
<button type="button" aria-label="Jarvis Live" title="Jarvis Live" onClick={toggleVoice}
className="rounded-md p-1.5 text-muted-foreground hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"><Mic className="h-3.5 w-3.5" /></button>
<button type="button" aria-label="Connect project" title="Connect project folder" onClick={connectProject}
diff --git a/jarvis/ui/web/frontend/src/components/layout/Sidebar.tsx b/jarvis/ui/web/frontend/src/components/layout/Sidebar.tsx
index 0b71137acd..21134c4aa4 100644
--- a/jarvis/ui/web/frontend/src/components/layout/Sidebar.tsx
+++ b/jarvis/ui/web/frontend/src/components/layout/Sidebar.tsx
@@ -25,6 +25,7 @@ import { useT } from "@/i18n";
import { RecentChats } from "@/components/home/RecentChats";
import { useHomeStore } from "@/store/home";
import { LazyIdeProjectTree } from "@/components/agentic/LazyIdeProjectTree";
+import { IDE_SECTIONS } from "@/lib/ideSections";
import { useIdeProjectsStore } from "@/store/ideProjects";
import { SidebarSearchBar } from "@/components/layout/SidebarSearchBar";
import { useQuickSwitchSettings } from "@/store/quickSwitchSettings";
@@ -65,17 +66,6 @@ const UpdateButton = lazy(() =>
* file is outside this change; once it lands these can go back to `cn`.
*/
-/**
- * The section ids the Agentic IDE answers to.
- *
- * Mirrors the nav row's own `matchIds` (see ./navGroups): the section has been
- * renamed twice and the older ids are still what some entry points set.
- */
-const IDE_SECTIONS: readonly string[] = [
- "agentic-ide",
- "chat-workspace",
- "agentic-ide-classic",
-];
/**
* The voice status dot, in the three colours a status is allowed to have.
diff --git a/jarvis/ui/web/frontend/src/components/layout/TopBar.tsx b/jarvis/ui/web/frontend/src/components/layout/TopBar.tsx
index 9d1a3314af..53964be54e 100644
--- a/jarvis/ui/web/frontend/src/components/layout/TopBar.tsx
+++ b/jarvis/ui/web/frontend/src/components/layout/TopBar.tsx
@@ -12,6 +12,8 @@ import { fill, useT } from "@/i18n";
import { cn } from "@/lib/utils";
import { CodingModeBadge } from "@/components/layout/CodingModeBadge";
import { SectionNavButtons } from "@/components/layout/SectionNavButtons";
+import { IdeLayoutSwitch } from "@/components/agentic/threads/IdeLayoutSwitch";
+import { IDE_SECTIONS } from "@/lib/ideSections";
import { useDesktopChrome, WindowControls } from "@/components/layout/WindowControls";
/**
@@ -90,6 +92,7 @@ export function TopBar() {
if (chrome.frameless) chrome.command("maximize");
}}
/>
+ <IdeCaptionSwitch />
<div className="flex shrink-0 items-center">
<CodingModeBadge />
{controls === "trailing" && (
@@ -100,6 +103,22 @@ export function TopBar() {
);
}
+/**
+ * The Agentic IDE's grid / threads switch, centred in the caption. Only on the
+ * IDE: everywhere else the caption's middle stays the window's drag handle.
+ * It floats over that handle rather than splitting it, so the strip keeps
+ * dragging on both sides of the switch.
+ */
+function IdeCaptionSwitch() {
+ const onIde = useEventStore((s) => IDE_SECTIONS.includes(s.activeSection));
+ if (!onIde) return null;
+ return (
+ <div className="pointer-events-none absolute inset-y-0 left-1/2 flex -translate-x-1/2 items-center">
+ <IdeLayoutSwitch className="pointer-events-auto" />
+ </div>
+ );
+}
+
// The restart can fail transiently right after an apply (the backend is busy,
// the desktop shell still warming) — retry briefly before giving up honestly.
const RESTART_ATTEMPTS = 3;
diff --git a/jarvis/ui/web/frontend/src/lib/ideSections.ts b/jarvis/ui/web/frontend/src/lib/ideSections.ts
new file mode 100644
index 0000000000..c169106fbc
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/lib/ideSections.ts
@@ -0,0 +1,9 @@
+/**
+ * The section ids the Agentic IDE answers to — the sidebar's IDE face and the
+ * caption's layout switch read the same list.
+ *
+ * Mirrors the nav row's own `matchIds` (see components/layout/navGroups): the
+ * section has been renamed twice and the older ids are still what some entry
+ * points set.
+ */
+export const IDE_SECTIONS: readonly string[] = ["agentic-ide", "chat-workspace", "agentic-ide-classic"];