Skip to content

The agent that grows with you

feat(desktop): unfocused session panes recede

Brooklyn Nicholson9c12d2d6c331
diff --git a/apps/desktop/src/app/chat/index.tsx b/apps/desktop/src/app/chat/index.tsx
index beda30da849..3f45065a562 100644
--- a/apps/desktop/src/app/chat/index.tsx
+++ b/apps/desktop/src/app/chat/index.tsx
@@ -23,6 +23,7 @@ import type { ChatMessage } from '@/lib/chat-messages'
import { NEW_SESSION_TITLE, quickModelOptions, sessionTitle } from '@/lib/chat-runtime'
import { useIncrementalExternalStoreRuntime } from '@/lib/incremental-external-store-runtime'
import { modelOptionsQueryKey, requestModelOptions } from '@/lib/model-options'
+import { useStoreSelector } from '@/lib/use-session-slice'
import { cn } from '@/lib/utils'
import { migrateSessionDraft } from '@/store/composer'
import { migrateQueuedPrompts, parkQueuedPrompts } from '@/store/composer-queue'
@@ -44,7 +45,7 @@ import {
sessionPinId,
shouldMigrateComposerScope
} from '@/store/session'
-import { sessionTileDelegate } from '@/store/session-states'
+import { $focusedStoredSessionId, sessionTileDelegate } from '@/store/session-states'
import { $transcriptTailBySessionId } from '@/store/transcript-tail'
import { isAuxiliaryWindow, isWatchWindow } from '@/store/windows'
import type { ModelOptionsResponse } from '@/types/hermes'
@@ -371,6 +372,13 @@ const ChatViewContent = memo(function ChatViewContent({
const isPrimary = view.kind === 'primary'
const activeSessionId = useStore(view.$runtimeId)
const storedId = useStore(view.$storedId)
+ // Multi-pane dimming: only the focused surface paints at full strength, so
+ // two sessions side by side read as "this one, and that one over there".
+ // A selector, not a plain useStore — the focused id changes on click, and a
+ // boolean bails every other surface out of the re-render. Sole surface ⇒
+ // always focused (the atom falls back to the primary's selection), so a
+ // single-pane workspace never dims.
+ const surfaceFocused = useStoreSelector($focusedStoredSessionId, focused => focused === storedId)
// Dock anchor for a session drop onto this surface: the workspace pane for the
// primary, this tile's pane id for a tile. Read by the session-drop bridge.
const sessionAnchor = isPrimary ? 'workspace' : `session-tile:${storedId ?? ''}`
@@ -575,6 +583,7 @@ const ChatViewContent = memo(function ChatViewContent({
className
)}
data-chat-surface=""
+ data-chat-unfocused={surfaceFocused ? undefined : ''}
data-composer-surface-id={composerSurfaceId}
data-composer-target={composerScope.target}
data-session-anchor={sessionAnchor}
diff --git a/apps/desktop/src/app/chat/sidebar/session-row.tsx b/apps/desktop/src/app/chat/sidebar/session-row.tsx
index 71e3cee7667..553061f882c 100644
--- a/apps/desktop/src/app/chat/sidebar/session-row.tsx
+++ b/apps/desktop/src/app/chat/sidebar/session-row.tsx
@@ -30,6 +30,7 @@ import { $projects } from '@/store/projects'
import { $pullRequestsByBranch, sessionPrKey } from '@/store/pull-requests'
import { $sessionDotStateById, hasLiveTurn, showsRunningArc } from '@/store/session-dot-state'
import { $sessionListDensity } from '@/store/session-list-density'
+import { $openStoredSessionIds } from '@/store/session-states'
import { sessionCostUsd } from '@/store/sidebar-archive'
import { $todoProgressBySession } from '@/store/todos'
@@ -173,6 +174,10 @@ function SidebarSessionRowImpl({
// those branches should repaint.
const prKey = sessionPrKey(session)
const pr = useStoreSelector($pullRequestsByBranch, prs => (rowMeta.includes('pr') && prKey ? prs[prKey] : undefined))
+ // Open in a pane, but not the focused one. A selector rather than a prop:
+ // it reaches all four row render paths at once, the set only changes when a
+ // tile opens or closes, and the boolean bails every unaffected row out.
+ const openUnfocused = useStoreSelector($openStoredSessionIds, open => !isSelected && open.has(session.id))
const totalTokens = session.input_tokens + session.output_tokens
const cost = sessionCostUsd(session)
@@ -352,6 +357,10 @@ function SidebarSessionRowImpl({
!card && density !== 'compact' && 'min-h-[2.75rem]',
!card && density === 'detailed' && 'min-h-[3.875rem]',
isSelected && 'bg-(--ui-row-active-background)',
+ // Open in another pane: the SAME band, just weaker. Its own mixed
+ // token rather than row opacity — dimming the whole row would take
+ // the title and the status dot down with it.
+ openUnfocused && 'bg-(--ui-row-open-background)',
liveTurn && 'text-foreground',
// Opaque surface while lifted so the dragged row erases what's under
// it (translucency let the rows below bleed through). data-glass-opaque
diff --git a/apps/desktop/src/store/session-states.ts b/apps/desktop/src/store/session-states.ts
index 9d98bced1b7..7f87673244c 100644
--- a/apps/desktop/src/store/session-states.ts
+++ b/apps/desktop/src/store/session-states.ts
@@ -997,6 +997,15 @@ export const $focusedStoredSessionId = computed(
}
)
+/** Every session currently OPEN as a surface: the primary's selection plus
+ * every tile's stored id. The sidebar highlights all of them (the focused one
+ * at full strength, the rest dimmed) so a multi-pane workspace shows which
+ * chats are on screen, not just the one being typed into. */
+export const $openStoredSessionIds = computed(
+ [$selectedStoredSessionId, $sessionTiles],
+ (selected, tiles) => new Set([...(selected ? [selected] : []), ...tiles.map(t => t.storedSessionId)])
+)
+
/** Live runtime id of the focused session (a tile's bound runtime, else the
* primary's active session). */
export const $focusedRuntimeId = computed(
diff --git a/apps/desktop/src/styles.css b/apps/desktop/src/styles.css
index 768ddc62d18..a65d9168cbc 100644
--- a/apps/desktop/src/styles.css
+++ b/apps/desktop/src/styles.css
@@ -300,6 +300,10 @@
var(--ui-accent) var(--theme-row-active-accent-mix),
color-mix(in srgb, var(--ui-base) 5%, transparent)
);
+ /* Open in a pane, but not the FOCUSED one: the active band at reduced
+ strength, so every session on screen is marked and the one you're in
+ still wins. Mixed from the active token so a theme tunes both at once. */
+ --ui-row-open-background: color-mix(in srgb, var(--ui-row-active-background) 28%, transparent);
--ui-control-hover-background: color-mix(
in srgb,
var(--ui-accent) var(--theme-control-hover-accent-mix),
@@ -1652,10 +1656,32 @@ body.guest-pointer-lock :is(webview, iframe) {
much stronger over a light backdrop), full strength in dark mode. */
:root {
--dock-glow-scale: 0.55;
+ /* Unfocused chat surface (multi-pane): a pane the user isn't in recedes so
+ the focused conversation reads as the one being worked in. Light needs a
+ deeper cut — a dim over a bright surface loses contrast far more slowly
+ than the same dim over a dark one. Pairs with a grayscale pass on the same
+ element — one treatment for the whole pane, not per-part tuning. */
+ --chat-unfocused-opacity: 0.62;
}
.dark {
--dock-glow-scale: 1;
+ --chat-unfocused-opacity: 0.72;
+}
+
+/* The whole surface recedes as ONE layer — thread, timeline rail, composer,
+ header — fading and desaturating together rather than each part taking its
+ own treatment. Both properties on the surface root also composite the
+ already-painted layer instead of repainting descendants. */
+[data-chat-surface][data-chat-unfocused] {
+ opacity: var(--chat-unfocused-opacity);
+ filter: grayscale(1);
+}
+
+[data-chat-surface] {
+ transition:
+ opacity 75ms ease-out,
+ filter 75ms ease-out;
}
/* Drag-region hatch — a diagonal ///// pattern (Photoshop-style) that fades into