From 50cbf032de87aead124a5f6566bd1d87610fb40f Mon Sep 17 00:00:00 2001 From: Chris Koeritz Date: Tue, 14 Aug 2018 15:52:40 -0400 Subject: [PATCH] debugging term title again now with gnome terminal WINDOWID is not set, so we're currently hosed. --- scripts/core/functions.sh | 3 +++ scripts/tty/terminal_titler.sh | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/scripts/core/functions.sh b/scripts/core/functions.sh index a8e00f22..071cf47c 100644 --- a/scripts/core/functions.sh +++ b/scripts/core/functions.sh @@ -187,6 +187,7 @@ if [ -z "$skip_all" ]; then # version for the other side (just 'linux'); we don't want the remote side still # thinking it's running xterm. save_terminal_title +echo TERM saved is $PRIOR_TERMINAL_TITLE #hmmm: why were we doing this? it scorches the user's logged in session, leaving it without proper terminal handling. # # we save the value of TERM; we don't want to leave the user's terminal # # brain dead once we come back from this function. @@ -195,7 +196,9 @@ if [ -z "$skip_all" ]; then /usr/bin/ssh -X -C "${args[@]}" # # restore the terminal variable also. # TERM="$oldterm" +echo TERM prior to restore is $PRIOR_TERMINAL_TITLE restore_terminal_title +echo TERM title restored } ############## diff --git a/scripts/tty/terminal_titler.sh b/scripts/tty/terminal_titler.sh index 9ef4f1c1..df3e6a8c 100644 --- a/scripts/tty/terminal_titler.sh +++ b/scripts/tty/terminal_titler.sh @@ -51,7 +51,9 @@ function get_terminal_title() which xprop &>/dev/null if [ $? -eq 0 ]; then # make sure we're actually using xterm *and* that we have a window ID. - if [[ "$TERM" =~ .*"xterm".* && ! -z "$WINDOWID" ]]; then + if [[ ! -z "$GNOME_TERMINAL_SCREEN" ]]; then + term_title_found="$(xprop -id $WINDOWID | perl -nle 'print $1 if /^WM_NAME.+= \"(.*)\"$/')" + elif [[ "$TERM" =~ .*"xterm".* && ! -z "$WINDOWID" ]]; then term_title_found="$(xprop -id $WINDOWID | perl -nle 'print $1 if /^WM_NAME.+= \"(.*)\"$/')" fi fi -- 2.34.1