feat(tui): add option to disable terminal title (#5713)

This commit is contained in:
Jake Nelson 2025-12-18 15:30:01 +11:00 committed by GitHub
parent b9fb180bc6
commit e789fcf5e5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 27 additions and 1 deletions

View file

@ -176,13 +176,15 @@ function App() {
const exit = useExit()
const promptRef = usePromptRef()
const [terminalTitleEnabled, setTerminalTitleEnabled] = createSignal(kv.get("terminal_title_enabled", true))
createEffect(() => {
console.log(JSON.stringify(route.data))
})
// Update terminal window title based on current route and session
createEffect(() => {
if (Flag.OPENCODE_DISABLE_TERMINAL_TITLE) return
if (!terminalTitleEnabled() || Flag.OPENCODE_DISABLE_TERMINAL_TITLE) return
if (route.data.type === "home") {
renderer.setTerminalTitle("OpenCode")
@ -453,6 +455,21 @@ function App() {
process.kill(0, "SIGTSTP")
},
},
{
title: terminalTitleEnabled() ? "Disable terminal title" : "Enable terminal title",
value: "terminal.title.toggle",
keybind: "terminal_title_toggle",
category: "System",
onSelect: (dialog) => {
setTerminalTitleEnabled((prev) => {
const next = !prev
kv.set("terminal_title_enabled", next)
if (!next) renderer.setTerminalTitle("")
return next
})
dialog.clear()
},
},
])
createEffect(() => {

View file

@ -559,6 +559,7 @@ export namespace Config {
session_child_cycle: z.string().optional().default("<leader>right").describe("Next child session"),
session_child_cycle_reverse: z.string().optional().default("<leader>left").describe("Previous child session"),
terminal_suspend: z.string().optional().default("ctrl+z").describe("Suspend terminal"),
terminal_title_toggle: z.string().optional().default("none").describe("Toggle terminal title"),
})
.strict()
.meta({

View file

@ -950,6 +950,10 @@ export type KeybindsConfig = {
* Suspend terminal
*/
terminal_suspend?: string
/**
* Toggle terminal title
*/
terminal_title_toggle?: string
}
export type AgentConfig = {

View file

@ -1110,6 +1110,10 @@ export type KeybindsConfig = {
* Suspend terminal
*/
terminal_suspend?: string
/**
* Toggle terminal title
*/
terminal_title_toggle?: string
}
export type AgentConfig = {