Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions packages/opencode/src/cli/cmd/tui/routes/session/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,22 @@ export function Session() {
}
}

function toggleChildSession() {
if (session()?.parentID) {
// Currently in child, go to parent
const parentID = session()?.parentID
if (parentID) {
navigate({
type: "session",
sessionID: parentID,
})
}
} else {
// Currently in primary, go to first child
moveFirstChild()
}
}

function childSessionHandler(func: (dialog: DialogContext) => void) {
return (dialog: DialogContext) => {
if (!session()?.parentID || dialog.stack.length > 0) return
Expand Down Expand Up @@ -962,6 +978,16 @@ export function Session() {
dialog.clear()
}),
},
{
title: session()?.parentID ? "Return to parent session" : "Show child sessions",
value: "session.child.toggle",
keybind: "session_child_toggle",
category: "Session",
onSelect: (dialog) => {
toggleChildSession()
dialog.clear()
},
},
{
title: "Next child session",
value: "session.child.next",
Expand Down
1 change: 1 addition & 0 deletions packages/opencode/src/config/keybinds.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ export const Keybinds = z
session_child_cycle: z.string().optional().default("right").describe("Go to next child session"),
session_child_cycle_reverse: z.string().optional().default("left").describe("Go to previous child session"),
session_parent: z.string().optional().default("up").describe("Go to parent session"),
session_child_toggle: z.string().optional().default("none").describe("Toggle between primary and child sessions"),
terminal_suspend: z.string().optional().default("ctrl+z").describe("Suspend terminal"),
terminal_title_toggle: z.string().optional().default("none").describe("Toggle terminal title"),
tips_toggle: z.string().optional().default("<leader>h").describe("Toggle tips on home screen"),
Expand Down