* Env-var heuristic for iTerm2's tmux integration mode (`tmux -CC` / `tmux -2CC`). * * In `-CC` mode, iTerm2 renders tmux panes as native splits — tmux runs * as a server (TMUX is set) but iTerm2 is the actual terminal emulator * for each pane, so TERM_PROGRAM stays `iTerm.app` and TERM is iTerm
()
| 27 | * authoritative backstop. Kept as a zero-subprocess fast path. |
| 28 | */ |
| 29 | function isTmuxControlModeEnvHeuristic(): boolean { |
| 30 | if (!process.env.TMUX) return false |
| 31 | if (process.env.TERM_PROGRAM !== 'iTerm.app') return false |
| 32 | // Belt-and-suspenders: in regular tmux TERM is screen-* or tmux-*; |
| 33 | // in -CC mode iTerm2 sets its own TERM (xterm-*). |
| 34 | const term = process.env.TERM ?? '' |
| 35 | return !term.startsWith('screen') && !term.startsWith('tmux') |
| 36 | } |
| 37 | |
| 38 | /** |
| 39 | * Sync one-shot probe: asks tmux directly whether this client is in control |
no outgoing calls
no test coverage detected