Expand description
Terminal detection from TTY device.
Provides cross-platform terminal detection by examining which process owns a TTY device.
§Detection Strategy
GUI terminal emulators (iTerm2, Ghostty, etc.) don’t have a controlling terminal - they CREATE PTYs for their child processes. So we can’t find them directly by their TTY.
Instead, we:
- Find a process on the TTY (e.g., the shell)
- Walk UP its parent chain to find the terminal emulator ancestor
Structs§
- Terminal
- A detected terminal emulator.
Enums§
- Terminal
Kind - Known terminal emulator types.
Functions§
- terminal
- Detect the terminal emulator that owns a TTY device.
- terminal_
from_ pid - Detect terminal from a specific process’s ancestry.