mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-24 03:54:43 -07:00
Use OSC 777 for terminal notifications (#25300)
This commit is contained in:
@@ -284,31 +284,43 @@ export class TerminalCapabilityManager {
|
||||
);
|
||||
}
|
||||
|
||||
supportsOsc9Notifications(env: NodeJS.ProcessEnv = process.env): boolean {
|
||||
if (env['WT_SESSION']) {
|
||||
return false;
|
||||
}
|
||||
isTmux(env: NodeJS.ProcessEnv = process.env): boolean {
|
||||
return !!env['TMUX'];
|
||||
}
|
||||
|
||||
return (
|
||||
this.hasOsc9TerminalSignature(this.getTerminalName()) ||
|
||||
this.hasOsc9TerminalSignature(env['TERM_PROGRAM']) ||
|
||||
this.hasOsc9TerminalSignature(env['TERM'])
|
||||
isScreen(env: NodeJS.ProcessEnv = process.env): boolean {
|
||||
return !!env['STY'];
|
||||
}
|
||||
|
||||
isITerm2(env: NodeJS.ProcessEnv = process.env): boolean {
|
||||
return !!(
|
||||
this.getTerminalName()?.toLowerCase().includes('iterm') ||
|
||||
env['TERM_PROGRAM']?.toLowerCase().includes('iterm')
|
||||
);
|
||||
}
|
||||
|
||||
private hasOsc9TerminalSignature(value: string | undefined): boolean {
|
||||
if (!value) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const normalized = value.toLowerCase();
|
||||
return (
|
||||
normalized.includes('wezterm') ||
|
||||
normalized.includes('ghostty') ||
|
||||
normalized.includes('iterm') ||
|
||||
normalized.includes('kitty')
|
||||
isAlacritty(env: NodeJS.ProcessEnv = process.env): boolean {
|
||||
return !!(
|
||||
this.getTerminalName()?.toLowerCase().includes('alacritty') ||
|
||||
env['ALACRITTY_WINDOW_ID'] ||
|
||||
env['TERM']?.toLowerCase().includes('alacritty')
|
||||
);
|
||||
}
|
||||
|
||||
isAppleTerminal(env: NodeJS.ProcessEnv = process.env): boolean {
|
||||
return !!(
|
||||
this.getTerminalName()?.toLowerCase().includes('apple_terminal') ||
|
||||
env['TERM_PROGRAM']?.toLowerCase().includes('apple_terminal')
|
||||
);
|
||||
}
|
||||
|
||||
isVSCodeTerminal(env: NodeJS.ProcessEnv = process.env): boolean {
|
||||
return !!env['TERM_PROGRAM']?.toLowerCase().includes('vscode');
|
||||
}
|
||||
|
||||
isWindowsTerminal(env: NodeJS.ProcessEnv = process.env): boolean {
|
||||
return !!env['WT_SESSION'];
|
||||
}
|
||||
}
|
||||
|
||||
export const terminalCapabilityManager =
|
||||
|
||||
Reference in New Issue
Block a user