Module detect

Module detect 

Source
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:

  1. Find a process on the TTY (e.g., the shell)
  2. Walk UP its parent chain to find the terminal emulator ancestor

Structs§

Terminal
A detected terminal emulator.

Enums§

TerminalKind
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.