mirror of
https://github.com/sst/opencode.git
synced 2025-12-23 10:11:41 +00:00
feat(tui): add option to disable terminal title (#5713)
This commit is contained in:
parent
b9fb180bc6
commit
e789fcf5e5
4 changed files with 27 additions and 1 deletions
|
|
@ -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(() => {
|
||||
|
|
|
|||
|
|
@ -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({
|
||||
|
|
|
|||
|
|
@ -950,6 +950,10 @@ export type KeybindsConfig = {
|
|||
* Suspend terminal
|
||||
*/
|
||||
terminal_suspend?: string
|
||||
/**
|
||||
* Toggle terminal title
|
||||
*/
|
||||
terminal_title_toggle?: string
|
||||
}
|
||||
|
||||
export type AgentConfig = {
|
||||
|
|
|
|||
|
|
@ -1110,6 +1110,10 @@ export type KeybindsConfig = {
|
|||
* Suspend terminal
|
||||
*/
|
||||
terminal_suspend?: string
|
||||
/**
|
||||
* Toggle terminal title
|
||||
*/
|
||||
terminal_title_toggle?: string
|
||||
}
|
||||
|
||||
export type AgentConfig = {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue