diff --git a/CHANGELOG.rst b/CHANGELOG.rst index b4c288372..5762e921e 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -62,6 +62,7 @@ Completions Improved terminal support ^^^^^^^^^^^^^^^^^^^^^^^^^ +- Fish now checks for the ``ts`` capability in terminfo to determine if a terminal supports setting the window title. Other improvements ------------------ diff --git a/fish-rust/src/curses.rs b/fish-rust/src/curses.rs index 977690ede..ca03669b2 100644 --- a/fish-rust/src/curses.rs +++ b/fish-rust/src/curses.rs @@ -118,6 +118,7 @@ pub struct Term { pub set_a_background: Option, pub set_background: Option, pub exit_attribute_mode: Option, + pub set_title: Option, // Number capabilities pub max_colors: Option, @@ -145,6 +146,7 @@ impl Term { set_a_background: get_str_cap("AB"), set_background: get_str_cap("Sb"), exit_attribute_mode: get_str_cap("me"), + set_title: get_str_cap("ts"), // Number capabilities max_colors: get_num_cap("Co"), diff --git a/fish-rust/src/env_dispatch.rs b/fish-rust/src/env_dispatch.rs index a7b0d7528..dc9915686 100644 --- a/fish-rust/src/env_dispatch.rs +++ b/fish-rust/src/env_dispatch.rs @@ -612,6 +612,10 @@ fn does_term_support_setting_title(vars: &EnvStack) -> bool { }; let term: &wstr = term.as_ref(); + if curses::term().is_some_and(|term| term.set_title.is_some()) { + return true; + } + let recognized = TITLE_TERMS.contains(&term) || term.starts_with(L!("xterm-")) || term.starts_with(L!("screen-"))