From 5a7f49c86876037c7c99c12b5e35ae6477f3de2d Mon Sep 17 00:00:00 2001 From: Chris Koeritz Date: Thu, 29 Jan 2015 19:44:16 -0500 Subject: [PATCH] added recovery of the terminal title from before ssh resets it, but only works for terminals under x11 so far. --- customizing/fred/scripts/ssh.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/customizing/fred/scripts/ssh.sh b/customizing/fred/scripts/ssh.sh index 9bf10d17..90b0a567 100755 --- a/customizing/fred/scripts/ssh.sh +++ b/customizing/fred/scripts/ssh.sh @@ -4,6 +4,9 @@ source "$FEISTY_MEOW_GENERATED/custom/scripts/pick_credentials.sh" +# save the former terminal title if we're running in X. +prior_title="$(xprop -id $WINDOWID | perl -nle 'print $1 if /^WM_NAME.+= \"(.*)\"$/')" + if [ ! -z "$keyfile" ]; then \ssh -i "$keyfile" -X -C -c blowfish-cbc $* else @@ -15,7 +18,11 @@ if [ $? -eq 0 ]; then if [ -z "$(echo $* | grep git)" ]; then # re-run the terminal labeller after coming back from ssh. # we check the exit value because we don't want to update this for a failed connection. - bash $FEISTY_MEOW_SCRIPTS/tty/label_terminal_with_infos.sh + if [ -z "$prior_title" ]; then + bash $FEISTY_MEOW_SCRIPTS/tty/label_terminal_with_infos.sh + else + bash $FEISTY_MEOW_SCRIPTS/tty/set_term_title.sh "$prior_title" + fi fi fi -- 2.34.1