Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
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 @@ -382,6 +382,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 @@ -985,6 +1001,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 @@ -107,6 +107,7 @@ const KeybindsSchema = Schema.Struct({
session_child_cycle: keybind("right", "Go to next child session"),
session_child_cycle_reverse: keybind("left", "Go to previous child session"),
session_parent: keybind("up", "Go to parent session"),
session_child_toggle: keybind("none", "Toggle between primary and child sessions"),
// `terminal_suspend` was formerly `.default("ctrl+z").transform((v) => win32 ? "none" : v)`,
// but `tui.ts` already forces the binding to "none" on win32 before calling
// `Keybinds.parse(...)`, so the schema-level transform was redundant.
Expand Down