1
1
mirror of https://github.com/wez/wezterm.git synced 2024-11-23 06:54:45 +03:00

mux: use pgrp leader basename as default pane title

If the pane title is the default `wezterm`, then return the
process basename instead.  This makes the tab titles more useful
by default, although on Windows, conpty will set the title
to the initial executable path and defeat this.
This commit is contained in:
Wez Furlong 2021-12-25 00:14:31 -07:00
parent 153861a639
commit b5d156c282

View File

@ -270,7 +270,19 @@ impl Pane for LocalPane {
}
fn get_title(&self) -> String {
self.terminal.borrow_mut().get_title().to_string()
let title = self.terminal.borrow_mut().get_title().to_string();
// If the title is the default pane title, then try to spice
// things up a bit by returning the process basename instead
if title == "wezterm" {
if let Some(proc_name) = self.get_foreground_process_name() {
let proc_name = std::path::Path::new(&proc_name);
if let Some(name) = proc_name.file_name() {
return name.to_string_lossy().to_string();
}
}
}
title
}
fn palette(&self) -> ColorPalette {