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.

feat(sidebar): project actions on right-click of a project header

enesfcfb9e2ea046
diff --git a/src/renderer/canvas/Canvas.tsx b/src/renderer/canvas/Canvas.tsx
index 055b8e77c..99173676f 100644
--- a/src/renderer/canvas/Canvas.tsx
+++ b/src/renderer/canvas/Canvas.tsx
@@ -3301,6 +3301,47 @@ export function Canvas() {
[commitActiveToStore, writeDisk]
)
+ // Right-click on a sidebar project header: the same project actions as the tab caret menu,
+ // in the shared ContextMenu shell.
+ const onProjectContextMenu = useCallback(
+ (e: React.MouseEvent, projectId: string) => {
+ e.preventDefault()
+ e.stopPropagation()
+ const project = useProjects.getState().projects.find((p) => p.id === projectId)
+ if (!project) return
+ setMenu({
+ x: e.clientX,
+ y: e.clientY,
+ items: [
+ {
+ label: 'Go to project',
+ icon: <IconSwitch />,
+ disabled: projectId === activeProjectId,
+ onClick: () => switchProject(projectId)
+ },
+ {
+ label: 'Rename',
+ icon: <IconEditor />,
+ onClick: () => {
+ void promptDialog({ message: 'Rename project', initialValue: project.name }).then((t) => {
+ if (t && t.trim()) renameProject(projectId, t.trim())
+ })
+ }
+ },
+ { label: 'Set folder…', icon: <IconProject />, onClick: () => setProjectFolder(projectId) },
+ { type: 'separator' },
+ {
+ label: 'Close project',
+ icon: <IconTrash />,
+ danger: true,
+ onClick: () => closeProject(projectId)
+ }
+ ]
+ })
+ },
+ [activeProjectId, switchProject, renameProject, setProjectFolder, closeProject]
+ )
+
// Reopen a previously closed project and make it active — the active-project effect reloads its
// serialized nodes, whose TerminalNodes reattach to the surviving tmux sessions (or cold-restore).
const reopenProject = useCallback(
@@ -3769,6 +3810,7 @@ export function Canvas() {
onMoveToGroup={moveSessionToGroup}
onReorder={reorderSession}
onRowContextMenu={onRowContextMenu}
+ onProjectContextMenu={onProjectContextMenu}
onAddToProject={addToProject}
onMouseEnter={openSessionsPeek}
onMouseLeave={closeSessionsPeekSoon}
diff --git a/src/renderer/components/SessionsSidebar.tsx b/src/renderer/components/SessionsSidebar.tsx
index 5f7567632..c2a40ff05 100644
--- a/src/renderer/components/SessionsSidebar.tsx
+++ b/src/renderer/components/SessionsSidebar.tsx
@@ -22,6 +22,8 @@ export interface SessionsSidebarProps {
onRenameSession(projectId: string, id: string, title: string): void
onAiNameSession(projectId: string, id: string, cwd?: string): void | Promise<void>
onRowContextMenu(e: React.MouseEvent, projectId: string, id: string): void
+ /** Right-click on a project header: the project actions menu (switch/rename/folder/close). */
+ onProjectContextMenu(e: React.MouseEvent, projectId: string): void
onAddToProject(projectId: string): void
/** Move a node into a canvas group (groupId) or out to the top level (null). */
onMoveToGroup(projectId: string, nodeId: string, groupId: string | null): void
@@ -212,6 +214,7 @@ export function SessionsSidebar(props: SessionsSidebarProps): JSX.Element | null
<div
className={`ss-group__head${dropClass(g.projectId, null)}`}
onClick={() => toggleCollapse(g.projectId, isCollapsed)}
+ onContextMenu={(e) => props.onProjectContextMenu(e, g.projectId)}
title={drag?.projectId === g.projectId ? 'Drop here to remove from group' : undefined}
{...dropProps(g.projectId, null)}
>