Skip to content

Node-based terminal manager for AI coding agents — tmux-backed terminals and parallel agent sessions as draggable nodes on an infinite pan/zoom canvas. macOS, Linux, and a browser Server Edition.

fix(sessions): keep unpinned sidebar open while hovering it

enes0e70fc020827
diff --git a/src/renderer/canvas/Canvas.tsx b/src/renderer/canvas/Canvas.tsx
index 930e95aba..f91f7c2c5 100644
--- a/src/renderer/canvas/Canvas.tsx
+++ b/src/renderer/canvas/Canvas.tsx
@@ -346,6 +346,31 @@ export function Canvas() {
})
}, [])
+ // Hover-peek: the sidebar overlaps its trigger icon, so leaving the icon (mouseleave)
+ // must not close the peek while the cursor moves onto the sidebar body. A single shared
+ // timer lets entering either surface cancel a pending close from the other.
+ const sessionsCloseTimer = useRef<ReturnType<typeof setTimeout> | null>(null)
+ const openSessionsPeek = useCallback(() => {
+ if (sessionsCloseTimer.current) {
+ clearTimeout(sessionsCloseTimer.current)
+ sessionsCloseTimer.current = null
+ }
+ setSessionsHover(true)
+ }, [])
+ const closeSessionsPeekSoon = useCallback(() => {
+ if (sessionsCloseTimer.current) clearTimeout(sessionsCloseTimer.current)
+ sessionsCloseTimer.current = setTimeout(() => {
+ sessionsCloseTimer.current = null
+ setSessionsHover(false)
+ }, 140)
+ }, [])
+ useEffect(
+ () => () => {
+ if (sessionsCloseTimer.current) clearTimeout(sessionsCloseTimer.current)
+ },
+ []
+ )
+
// Serialized inputs for the active project's terminal/agent nodes (the sidebar reads the
// serialized nodes of *inactive* projects directly from the store, but the active project's
// live state lives in React Flow — pass it through here).
@@ -1895,10 +1920,8 @@ export function Canvas() {
<div
className="sessions-icon-cluster"
- onMouseEnter={() => setSessionsHover(true)}
- onMouseLeave={() => {
- if (!sessionsPinned) setTimeout(() => setSessionsHover(false), 60)
- }}
+ onMouseEnter={openSessionsPeek}
+ onMouseLeave={closeSessionsPeekSoon}
>
<button title="Sessions (⌘⇧L)" onClick={toggleSessionsPin}>
<IconSessions />
@@ -2052,6 +2075,8 @@ export function Canvas() {
onRenameSession={renameSession}
onRowContextMenu={onRowContextMenu}
onAddToProject={addToProject}
+ onMouseEnter={openSessionsPeek}
+ onMouseLeave={closeSessionsPeekSoon}
/>
{confirm && (
diff --git a/src/renderer/components/SessionsSidebar.tsx b/src/renderer/components/SessionsSidebar.tsx
index 446221fe3..9adb600ef 100644
--- a/src/renderer/components/SessionsSidebar.tsx
+++ b/src/renderer/components/SessionsSidebar.tsx
@@ -27,6 +27,8 @@ export interface SessionsSidebarProps {
onRenameSession(projectId: string, id: string, title: string): void
onRowContextMenu(e: React.MouseEvent, projectId: string, id: string): void
onAddToProject(projectId: string): void
+ onMouseEnter?(): void
+ onMouseLeave?(): void
}
export function SessionsSidebar(props: SessionsSidebarProps): JSX.Element | null {
@@ -82,7 +84,11 @@ export function SessionsSidebar(props: SessionsSidebarProps): JSX.Element | null
if (!open) return null
return (
- <aside className="sessions-sidebar" onMouseLeave={pinned ? undefined : props.onClose}>
+ <aside
+ className="sessions-sidebar"
+ onMouseEnter={props.onMouseEnter}
+ onMouseLeave={props.onMouseLeave}
+ >
<div className="sessions-sidebar__head">
<span className="sessions-sidebar__title">Sessions</span>
<span className="sessions-sidebar__count">{total}</span>