summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSven Wegener <swegener@gentoo.org>2024-06-22 18:47:32 +0200
committerSven Wegener <swegener@gentoo.org>2024-06-22 22:26:45 +0200
commit9ff9f8199ccf9d55fb1cf066cbbc791101894ab0 (patch)
tree3c21a92ae8de6325313a7229263782310c2fe089 /app-shells
parentdev-libs/opencl-clang: add 18.1.0 (diff)
downloadgentoo-9ff9f8199ccf9d55fb1cf066cbbc791101894ab0.tar.gz
gentoo-9ff9f8199ccf9d55fb1cf066cbbc791101894ab0.tar.bz2
gentoo-9ff9f8199ccf9d55fb1cf066cbbc791101894ab0.zip
app-shells/bash: do not update internal window title of screen and tmux
The k escape sequence changes the internal window title of screen and tmux, which is an alias given to the window by the user. The alias can be used to reference the window in internal commands, e.g. by using "select <alias>" in screen or "select-window -t <alias>" in tmux to switch to a window by name, and should not be updated by commands running inside of screen and tmux. Closes: https://bugs.gentoo.org/934732 Signed-off-by: Sven Wegener <swegener@gentoo.org>
Diffstat (limited to 'app-shells')
-rw-r--r--app-shells/bash/files/bashrc.d/10-gentoo-title.bash32
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