Lines 16-22
genfun_set_win_title() {
Link Here
|
16 |
|
16 |
|
17 |
# Sets the window title with the Set Text Parameters sequence. For |
17 |
# Sets the window title with the Set Text Parameters sequence. For |
18 |
# screen, the sequence defines the hardstatus (%h) and for tmux, the |
18 |
# screen, the sequence defines the hardstatus (%h) and for tmux, the |
19 |
# window_name (#W). For graphical terminal emulators, it is normal for |
19 |
# pane_title (#T). For graphical terminal emulators, it is normal for |
20 |
# the title bar be affected. |
20 |
# the title bar be affected. |
21 |
genfun_set_win_title() { |
21 |
genfun_set_win_title() { |
22 |
genfun_sanitise_cwd |
22 |
genfun_sanitise_cwd |
Lines 26-52
genfun_set_win_title() {
Link Here
|
26 |
genfun_set_win_title |
26 |
genfun_set_win_title |
27 |
} |
27 |
} |
28 |
|
28 |
|
29 |
# Set window title with the Title Definition String sequence. For screen, the |
29 |
# If the TTY is that of sshd(8) then proceed no further. Alas, there exist many |
30 |
# sequence defines the window title (%t) and for tmux, the pane_title (#T). |
30 |
# operating environments in which the window title would otherwise not be |
31 |
# For tmux to be affected requires that its allow-rename option be enabled. |
31 |
# restored upon ssh(1) exiting. Users wishing to coerce the historical |
32 |
# https://www.gnu.org/software/screen/manual/html_node/Control-Sequences.html |
32 |
# behaviour have the option of setting PROMPT_COMMAND=(genfun_set_win_title). |
33 |
case ${TERM} in |
33 |
if [[ ${SSH_TTY} && ${SSH_TTY} == "$(tty)" ]]; then |
34 |
screen*|tmux*) |
34 |
return |
35 |
genfun_set_pane_title() { |
35 |
fi |
36 |
printf '\033k%s\033\\' "${HOSTNAME%%.*}" |
|
|
37 |
} |
38 |
PROMPT_COMMAND+=('genfun_set_pane_title') |
39 |
;; |
40 |
*) |
41 |
# If the TTY is that of sshd(8) then proceed no further. Alas, |
42 |
# there exist many operating environments in which the window |
43 |
# title would otherwise not be restored upon ssh(1) exiting. |
44 |
# Users wishing to coerce the historical behaviour have the |
45 |
# option of setting PROMPT_COMMAND=(genfun_set_win_title). |
46 |
if [[ ${SSH_TTY} && ${SSH_TTY} == "$(tty)" ]]; then |
47 |
return |
48 |
fi |
49 |
esac |
50 |
|
36 |
|
51 |
# Determine whether the terminal can handle the Set Text Parameters sequence. |
37 |
# Determine whether the terminal can handle the Set Text Parameters sequence. |
52 |
# The only terminals permitted here are those for which there is empirical |
38 |
# The only terminals permitted here are those for which there is empirical |