Skip to content

Commit 6afdb5c

Browse files
authored
tui: added ctrl-z terminal suspension support (#3983)
1 parent bdcf864 commit 6afdb5c

3 files changed

Lines changed: 20 additions & 0 deletions

File tree

‎packages/opencode/src/cli/cmd/tui/app.tsx‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,21 @@ function App() {
342342
dialog.clear()
343343
},
344344
},
345+
{
346+
title: "Suspend terminal",
347+
value: "terminal.suspend",
348+
keybind: "terminal_suspend",
349+
category: "System",
350+
onSelect: () => {
351+
process.once("SIGCONT", () => {
352+
renderer.resume()
353+
})
354+
355+
renderer.suspend()
356+
// pid=0 means send the signal to all processes in the process group
357+
process.kill(0, "SIGTSTP")
358+
},
359+
},
345360
])
346361

347362
createEffect(() => {

‎packages/opencode/src/config/config.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -430,6 +430,7 @@ export namespace Config {
430430
history_next: z.string().optional().default("down").describe("Next history item"),
431431
session_child_cycle: z.string().optional().default("<leader>right").describe("Next child session"),
432432
session_child_cycle_reverse: z.string().optional().default("<leader>left").describe("Previous child session"),
433+
terminal_suspend: z.string().optional().default("ctrl+z").describe("Suspend terminal"),
433434
})
434435
.strict()
435436
.meta({

‎packages/sdk/js/src/gen/types.gen.ts‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -846,6 +846,10 @@ export type KeybindsConfig = {
846846
* Previous child session
847847
*/
848848
session_child_cycle_reverse?: string
849+
/**
850+
* Suspend terminal
851+
*/
852+
terminal_suspend?: string
849853
}
850854

851855
export type AgentConfig = {

0 commit comments

Comments
 (0)