new multi-file pattern search and replace.
[feisty_meow.git] / customizing / fred / scripts / ssh.sh
index 2e1b3742f227cfabc167ca9f4762f54089e9a52a..90b0a56721af9421995d3286fd309f41a3d0ff78 100755 (executable)
@@ -2,7 +2,10 @@
 
 # wraps our calling the secure shell and lets us pick our credentials.
 
-source "$FEISTY_MEOW_SCRIPTS/security/pick_credentials.sh"
+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 $*
@@ -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