From: Chris Koeritz Date: Tue, 14 Nov 2017 22:36:32 +0000 (-0500) Subject: working on terminal titles X-Git-Tag: 2.140.100^2~13^2~1 X-Git-Url: https://feistymeow.org/gitweb/?a=commitdiff_plain;ds=sidebyside;h=8d62fc5172372ffab8b751235e499a65662750e2;hp=-c;p=feisty_meow.git working on terminal titles --- 8d62fc5172372ffab8b751235e499a65662750e2 diff --git a/scripts/core/functions.sh b/scripts/core/functions.sh index c078c90a..007f4746 100644 --- a/scripts/core/functions.sh +++ b/scripts/core/functions.sh @@ -174,9 +174,9 @@ if [ -z "$skip_all" ]; then local oldterm="$TERM" export TERM=linux /usr/bin/ssh -X -C "${args[@]}" - restore_terminal_title # restore the terminal variable also. TERM="$oldterm" + restore_terminal_title } ############## diff --git a/scripts/tty/terminal_titler.sh b/scripts/tty/terminal_titler.sh index 36086021..f32b10b5 100644 --- a/scripts/tty/terminal_titler.sh +++ b/scripts/tty/terminal_titler.sh @@ -17,7 +17,8 @@ function apply_title_to_terminal() title="$(hostname)" fi - if [ "${TERM}" != "dumb" -a -z "$PBS_ENVIRONMENT" -a ! -z "$PS1" ]; then + if [ "${TERM}" != "dumb" -a -z "$PBS_ENVIRONMENT" -a \ + ! -z "$PS1" -a "${TERM}" != "linux" ]; then echo -n -e "\033]0;${title}\007" else # not running interactively, so just echo the title. @@ -31,15 +32,20 @@ function apply_title_to_terminal() function set_terminal_title() { apply_title_to_terminal $* - # we're enforcing a new title from here on. - unset PRIOR_TERMINAL_TITLE + +#tricky tries to get it to be available when we ask for it in get_terminal_title + sync +# echo -n + +# # we're enforcing a new title from here on. +# unset PRIOR_TERMINAL_TITLE save_terminal_title } # echoes back the current title on the terminal window, if we can acquire it. function get_terminal_title() { - local term_title_found="" + local term_title_found # save the former terminal title if we're running in X with xterm. which xprop &>/dev/null if [ $? -eq 0 ]; then