Skip to content

Commit 937b926

Browse files
committed
feat: include current directory in terminal title
- The terminal title now shows "Codex CLI | {directory_name}" where directory_name is the current working directory's basename.
1 parent a326de3 commit 937b926

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

codex-rs/tui/src/tui.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
use std::io::Result;
22
use std::io::Stdout;
33
use std::io::stdout;
4+
use std::env;
45

56
use codex_core::config::Config;
67
use crossterm::cursor::MoveTo;
@@ -44,9 +45,15 @@ pub fn init(_config: &Config) -> Result<Tui> {
4445
set_panic_hook();
4546

4647
// Set terminal title and clear screen and move cursor to top-left before drawing UI
48+
let current_dir = env::current_dir()
49+
.ok()
50+
.and_then(|path| path.file_name().map(|name| name.to_string_lossy().into_owned()))
51+
.unwrap_or_else(|| "Unknown".to_string());
52+
let title = format!("Codex CLI | {}", current_dir);
53+
4754
execute!(
4855
stdout(),
49-
SetTitle("Codex CLI"),
56+
SetTitle(&title),
5057
Clear(ClearType::All),
5158
MoveTo(0, 0)
5259
)?;

0 commit comments

Comments
 (0)