diff --git a/packages/opencode/src/cli/cmd/tui/app.tsx b/packages/opencode/src/cli/cmd/tui/app.tsx index 7bb10de899a..34833f5267c 100644 --- a/packages/opencode/src/cli/cmd/tui/app.tsx +++ b/packages/opencode/src/cli/cmd/tui/app.tsx @@ -342,6 +342,21 @@ function App() { dialog.clear() }, }, + { + title: "Suspend terminal", + value: "terminal.suspend", + keybind: "terminal_suspend", + category: "System", + onSelect: () => { + process.once("SIGCONT", () => { + renderer.resume() + }) + + renderer.suspend() + // pid=0 means send the signal to all processes in the process group + process.kill(0, "SIGTSTP") + }, + }, ]) createEffect(() => { diff --git a/packages/opencode/src/config/config.ts b/packages/opencode/src/config/config.ts index 3ffb76cbaea..837899be575 100644 --- a/packages/opencode/src/config/config.ts +++ b/packages/opencode/src/config/config.ts @@ -430,6 +430,7 @@ export namespace Config { history_next: z.string().optional().default("down").describe("Next history item"), session_child_cycle: z.string().optional().default("right").describe("Next child session"), session_child_cycle_reverse: z.string().optional().default("left").describe("Previous child session"), + terminal_suspend: z.string().optional().default("ctrl+z").describe("Suspend terminal"), }) .strict() .meta({ diff --git a/packages/sdk/js/src/gen/types.gen.ts b/packages/sdk/js/src/gen/types.gen.ts index 31401b2452c..4c1cb33fbea 100644 --- a/packages/sdk/js/src/gen/types.gen.ts +++ b/packages/sdk/js/src/gen/types.gen.ts @@ -846,6 +846,10 @@ export type KeybindsConfig = { * Previous child session */ session_child_cycle_reverse?: string + /** + * Suspend terminal + */ + terminal_suspend?: string } export type AgentConfig = {