From 8d62fc5172372ffab8b751235e499a65662750e2 Mon Sep 17 00:00:00 2001 From: Chris Koeritz Date: Tue, 14 Nov 2017 17:36:32 -0500 Subject: [PATCH] working on terminal titles --- scripts/core/functions.sh | 2 +- scripts/tty/terminal_titler.sh | 14 ++++++++++---- 2 files changed, 11 insertions(+), 5 deletions(-) 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 -- 2.34.1