tasty revision to load feisty for full use
[feisty_meow.git] / scripts / tty / terminal_titler.sh
index 3751ba24f781dfab48fa63dd481fc89722645ed2..329ec57c7664fc563dddba10e2f0b2c7754b0fa3 100644 (file)
@@ -1,6 +1,6 @@
 #!/bin/bash
 
-source $FEISTY_MEOW_SCRIPTS/core/functions.sh
+source "$FEISTY_MEOW_SCRIPTS/core/functions.sh"
 
 # just saying this is an array...
 #declare -a PRIOR_TERMINAL_TITLES
@@ -81,7 +81,8 @@ function save_terminal_title()
   # save the former terminal title if we're running in X with xterm.
   which xprop &>/dev/null
   if [ $? -eq 0 ]; then
-    if [[ "$TERM" =~ .*"xterm".* ]]; then
+    # make sure we're actually using xterm *and* that we have a window ID.
+    if [[ "$TERM" =~ .*"xterm".* && ! -z "$WINDOWID" ]]; then
       local prior_title="$(xprop -id $WINDOWID | perl -nle 'print $1 if /^WM_NAME.+= \"(.*)\"$/')"
       if [ ! -z "$prior_title" ]; then
 #echo "saving prior terminal title as '$prior_title'"