MCPcopy Index your code
hub / github.com/codeaashu/claude-code / detectLinuxTerminal

Function detectLinuxTerminal

src/utils/deepLink/terminalLauncher.ts:127–152  ·  view source on GitHub ↗

* Detect the user's preferred terminal on Linux. * Checks $TERMINAL, then x-terminal-emulator, then walks a priority list.

()

Source from the content-addressed store, hash-verified

125 * Checks $TERMINAL, then x-terminal-emulator, then walks a priority list.
126 */
127async function detectLinuxTerminal(): Promise<TerminalInfo | null> {
128 // Check $TERMINAL env var
129 const termEnv = process.env.TERMINAL
130 if (termEnv) {
131 const resolved = await which(termEnv)
132 if (resolved) {
133 return { name: basename(termEnv), command: resolved }
134 }
135 }
136
137 // Check x-terminal-emulator (Debian/Ubuntu alternative)
138 const xte = await which('x-terminal-emulator')
139 if (xte) {
140 return { name: 'x-terminal-emulator', command: xte }
141 }
142
143 // Walk the priority list
144 for (const terminal of LINUX_TERMINALS) {
145 const resolved = await which(terminal)
146 if (resolved) {
147 return { name: terminal, command: resolved }
148 }
149 }
150
151 return null
152}
153
154/**
155 * Detect the user's preferred terminal on Windows.

Callers 1

detectTerminalFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected