From fab613bd931dfee36d1bf5f4e09f8d9a7fa56407 Mon Sep 17 00:00:00 2001 From: John D Pell <52194+gaelicWizard@users.noreply.github.com> Date: Tue, 13 Oct 2026 01:41:24 -0700 Subject: [PATCH] fix(termsupport): improve Apple Terminal support (#14172) --- lib/termsupport.zsh | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/termsupport.zsh b/lib/termsupport.zsh index 6af8fe730..c2623887a 100644 --- a/lib/termsupport.zsh +++ b/lib/termsupport.zsh @@ -5,7 +5,6 @@ # See: http://www.faqs.org/docs/Linux-mini/Xterm-Title.html#ss3.1 # Fully supports screen, iterm, and probably most modern xterm and rxvt # (In screen, only short_tab_title is used) -# Limited support for Apple Terminal (Terminal can't set window and tab separately) function title { setopt localoptions nopromptsubst @@ -17,7 +16,7 @@ function title { : ${2=$1} case "$TERM" in - cygwin|xterm*|putty*|rxvt*|konsole*|ansi|mlterm*|alacritty*|st*|foot*|contour*|wezterm*) + cygwin|xterm*|putty*|rxvt*|konsole*|ansi|mlterm*|alacritty*|st*|foot*|contour*|wezterm*|nsterm*) print -Pn "\e]2;${2:q}\a" # set window name print -Pn "\e]1;${1:q}\a" # set tab name ;; @@ -26,10 +25,12 @@ function title { print -Pn "\ek${1:q}\e\\" # set screen hardstatus/tmux window name if `allow-rename` is on ;; *) - if [[ "$TERM_PROGRAM" == "iTerm.app" ]]; then + case "$TERM_PROGRAM" in + "iTerm.app"|"Apple_Terminal") print -Pn "\e]2;${2:q}\a" # set window name print -Pn "\e]1;${1:q}\a" # set tab name - else + ;; + *) # Try to use terminfo to set the title if the feature is available if (( ${+terminfo[fsl]} && ${+terminfo[tsl]} )); then # Emit the capabilities with echoti so terminfo does its own parameter @@ -39,7 +40,8 @@ function title { print -Pn "$1" echoti fsl fi - fi + ;; + esac ;; esac }