focus_session

Function focus_session 

Source
pub fn focus_session(pid: i32, mux_hint: Option<&str>) -> FocusResult
Expand description

Focus the terminal window containing the given process.

This is the main entry point for the library. It handles:

  1. Multiplexer detection and pane switching (tmux, etc.)
  2. Terminal detection from TTY
  3. Terminal-specific focusing (iTerm2, Terminal.app, etc.)
  4. Generic window activation fallback

Uses FocusMode::SingleWindow by default (brings only the target window to the front). Use focus_session_with_mode for explicit mode control.

§Arguments

  • pid - Process ID of the session
  • mux_hint - Optional hint about the multiplexer type (e.g., “tmux”)

§Returns

A FocusResult indicating what happened.