X-Git-Url: https://feistymeow.org/gitweb/?a=blobdiff_plain;f=customizing%2Ffred%2Fscripts%2Fssh.sh;h=316228c1f01ad16f8ba88b9cfddb3d98aa9db324;hb=9324c679745724be4b8f67402b0940e438a1370b;hp=9bf10d17888de7775dbea40356a7e0713529304f;hpb=baf34d26f73b32deb1a89feb0fa2d1469e397405;p=feisty_meow.git diff --git a/customizing/fred/scripts/ssh.sh b/customizing/fred/scripts/ssh.sh old mode 100755 new mode 100644 index 9bf10d17..316228c1 --- a/customizing/fred/scripts/ssh.sh +++ b/customizing/fred/scripts/ssh.sh @@ -2,12 +2,33 @@ # wraps our calling the secure shell and lets us pick our credentials. -source "$FEISTY_MEOW_GENERATED/custom/scripts/pick_credentials.sh" +source "$FEISTY_MEOW_LOADING_DOCK/custom/scripts/pick_credentials.sh" + +# save the former terminal title if we're running in X with xterm. +prior_title= +which xprop &>/dev/null +if [ $? -eq 0 ]; then + if [[ "$TERM" =~ .*"xterm".* ]]; then + prior_title="$(xprop -id $WINDOWID | perl -nle 'print $1 if /^WM_NAME.+= \"(.*)\"$/')" + fi +fi + +# force the TERM variable to a more generic version for other side. +# we don't want the remote side still thinking it's running xterm. +export TERM=linux + +#hmmm: it would be good to set an interrupt handler here and +# trap ctrl-c, since otherwise we are getting exited from and losing a chance +# to reset the terminal title. this actually happens a lot, since some X11 +# or other background process is left running and the ssh never actually quits, +# forcing one to hit ctrl-c. if [ ! -z "$keyfile" ]; then - \ssh -i "$keyfile" -X -C -c blowfish-cbc $* + \ssh -i "$keyfile" -X -C $* +#-c blowfish-cbc else - \ssh -X -C -c blowfish-cbc $* + \ssh -X -C $* +#-c blowfish-cbc fi if [ $? -eq 0 ]; then @@ -15,7 +36,13 @@ 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 +#echo prior title nil new label + bash $FEISTY_MEOW_SCRIPTS/tty/label_terminal_with_infos.sh + else +#echo "using old prior title of '$prior_title'" + bash $FEISTY_MEOW_SCRIPTS/tty/set_term_title.sh "$prior_title" + fi fi fi