pub type TerminalPwdChangedFn = Option<unsafe extern "C" fn(terminal: Terminal, userdata: *mut c_void)>;Expand description
Callback function type for pwd_changed.
Called when the terminal pwd (current working directory) changes via escape sequences: OSC 7 (file:// URI), OSC 9 (ConEmu CurrentDir), or OSC 1337 CurrentDir (iTerm2). Use ghostty_terminal_get() with GHOSTTY_TERMINAL_DATA_PWD inside the callback to read the new value.
The terminal stores whatever bytes the shell emitted, without parsing. That means for OSC 7 the value is the raw URI (typically file://…); for OSC 9/OSC 1337 it is typically a bare path. The embedder is responsible for decoding any URI scheme or host if it cares about them.
The callback also fires when the shell clears the pwd (e.g. an empty OSC 7). In that case GHOSTTY_TERMINAL_DATA_PWD returns a zero-length string.
Aliased Type§
pub enum TerminalPwdChangedFn {
None,
Some(unsafe extern "C" fn(*mut TerminalImpl, *mut c_void)),
}