(title: string | null)
| 15 | * Elsewhere, writes OSC 0 (set title+icon) via Ink's stdout. |
| 16 | */ |
| 17 | export function useTerminalTitle(title: string | null): void { |
| 18 | const writeRaw = useContext(TerminalWriteContext) |
| 19 | |
| 20 | useEffect(() => { |
| 21 | if (title === null || !writeRaw) return |
| 22 | |
| 23 | const clean = stripAnsi(title) |
| 24 | |
| 25 | if (process.platform === 'win32') { |
| 26 | process.title = clean |
| 27 | } else { |
| 28 | writeRaw(osc(OSC.SET_TITLE_AND_ICON, clean)) |
| 29 | } |
| 30 | }, [title, writeRaw]) |
| 31 | } |
| 32 |
no test coverage detected