diff options
Diffstat (limited to 'app-shells/bash/files/bashrc.d/10-gentoo-title.bash')
-rw-r--r-- | app-shells/bash/files/bashrc.d/10-gentoo-title.bash | 32 |
1 files changed, 9 insertions, 23 deletions
diff --git a/app-shells/bash/files/bashrc.d/10-gentoo-title.bash b/app-shells/bash/files/bashrc.d/10-gentoo-title.bash index 0246d4fa36f0..003e364ff072 100644 --- a/app-shells/bash/files/bashrc.d/10-gentoo-title.bash +++ b/app-shells/bash/files/bashrc.d/10-gentoo-title.bash @@ -16,8 +16,8 @@ genfun_set_win_title() { # Sets the window title with the Set Text Parameters sequence. For # screen, the sequence defines the hardstatus (%h) and for tmux, the - # window_name (#W). For graphical terminal emulators, it is normal for - # the title bar be affected. + # pane_title (#T). For graphical terminal emulators, it is normal for + # the title bar to be affected. genfun_set_win_title() { genfun_sanitise_cwd printf '\033]2;%s@%s - %s\007' "${USER}" "${HOSTNAME%%.*}" "${_cwd}" @@ -26,27 +26,13 @@ genfun_set_win_title() { genfun_set_win_title } -# Set window title with the Title Definition String sequence. For screen, the -# sequence defines the window title (%t) and for tmux, the pane_title (#T). -# For tmux to be affected requires that its allow-rename option be enabled. -# https://www.gnu.org/software/screen/manual/html_node/Control-Sequences.html -case ${TERM} in - screen*|tmux*) - genfun_set_pane_title() { - printf '\033k%s\033\\' "${HOSTNAME%%.*}" - } - PROMPT_COMMAND+=('genfun_set_pane_title') - ;; - *) - # If the TTY is that of sshd(8) then proceed no further. Alas, - # there exist many operating environments in which the window - # title would otherwise not be restored upon ssh(1) exiting. - # Users wishing to coerce the historical behaviour have the - # option of setting PROMPT_COMMAND=(genfun_set_win_title). - if [[ ${SSH_TTY} && ${SSH_TTY} == "$(tty)" ]]; then - return - fi -esac +# If the TTY is that of sshd(8) then proceed no further. Alas, there exist many +# operating environments in which the window title would otherwise not be +# restored upon ssh(1) exiting. Users wishing to coerce the historical +# behaviour have the option of setting PROMPT_COMMAND=(genfun_set_win_title). +if [[ ${SSH_TTY} && ${SSH_TTY} == "$(tty)" ]]; then + return +fi # Determine whether the terminal can handle the Set Text Parameters sequence. # The only terminals permitted here are those for which there is empirical |