启动时终端框架标题中的文本是什么?

启动时终端框架标题中的文本是什么?

当我在 macOS 上启动终端窗口时,以下文本会在框架标题中滚动:

终端初始化

我认出了其中的一些brewpyenv,以及一些基本的 posix 包,但我不确定它们都来自哪里。

答案1

作为有人在评论中说,它们是由你的启动脚本运行的程序。你还可以控制终端标题正在使用什么:

# Set terminal window and tab/icon title
#
# usage: title short_tab_title [long_window_title]
#
# 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 {
    # forked from OMZ, see https://superuser.com/a/344397/856545 for setting tab and window separately
    emulate -L zsh
    setopt prompt_subst

    {
        [[ "$EMACS" == *term* ]] && return

        # if $2 is unset use $1 as default
        # if it is set and empty, leave it as is
        : ${2=$1}

        case "$TERM" in
            cygwin|xterm*|putty*|rxvt*|ansi)
                print -Pn "\e]2;$2:q\a" # set window name
                print -Pn "\e]1;$1:q\a" # set tab name
                ;;
            screen*)
                print -Pn "\ek$1:q\e\\" # set screen hardstatus
                ;;
            *)
                if [[ "$TERM_PROGRAM" == "iTerm.app" ]]; then
                    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 set title
                    if [[ -n "$terminfo[fsl]" ]] && [[ -n "$terminfo[tsl]" ]]; then
                        echoti tsl
                        print -Pn "$1"
                        echoti fsl
                    fi
                fi
                ;;
        esac
    } >/dev/tty
}

相关内容