From 2ed1b378cb8a66085cf308d2e41409db2ed1afbb Mon Sep 17 00:00:00 2001
From: Marat Boshernitsan <maratb@google.com>
Date: Tue, 8 Jul 2025 12:34:17 -0700
Subject: fix: Honor DEBUG and CLI_TITLE environment variables (#3560)

---
 packages/cli/src/gemini.tsx | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

(limited to 'packages/cli/src/gemini.tsx')

diff --git a/packages/cli/src/gemini.tsx b/packages/cli/src/gemini.tsx
index 89f5eb3a..91425d8d 100644
--- a/packages/cli/src/gemini.tsx
+++ b/packages/cli/src/gemini.tsx
@@ -222,7 +222,12 @@ export async function main() {
 
 function setWindowTitle(title: string, settings: LoadedSettings) {
   if (!settings.merged.hideWindowTitle) {
-    process.stdout.write(`\x1b]2; Gemini - ${title} \x07`);
+    const windowTitle = (process.env.CLI_TITLE || `Gemini - ${title}`).replace(
+      // eslint-disable-next-line no-control-regex
+      /[\x00-\x1F\x7F]/g,
+      '',
+    );
+    process.stdout.write(`\x1b]2;${windowTitle}\x07`);
 
     process.on('exit', () => {
       process.stdout.write(`\x1b]2;\x07`);
-- 
cgit v1.2.3

