aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2014-10-16 11:09:01 -0300
committerSilvio Rhatto <rhatto@riseup.net>2014-10-16 11:09:01 -0300
commit6c6fa04b79902363af3b049fb8a749b40eafcc9b (patch)
tree6be370fd9baaf69ea4d01f45b77fbf085e60000c
parentaac512901f6932f1a8737fcf9671e80d60b19add (diff)
downloadtermplex-6c6fa04b79902363af3b049fb8a749b40eafcc9b.tar.gz
termplex-6c6fa04b79902363af3b049fb8a749b40eafcc9b.tar.bz2
Restore term title
-rwxr-xr-xshell14
1 files changed, 8 insertions, 6 deletions
diff --git a/shell b/shell
index aa1b8d2..0d6758e 100755
--- a/shell
+++ b/shell
@@ -8,11 +8,13 @@ BASENAME="`basename $0`"
DEST="$1"
COMMAND="$2"
-# Set screen title
+# Set window title
# http://stackoverflow.com/questions/899609/gnu-screen-run-script-that-sends-commands-to-the-screen-session-it-is-being-run
-function screen_title {
+function window_title {
if [ -n "$STY" ]; then
screen -p $WINDOW -X title $1
+ else
+ xtitle $1
fi
}
@@ -22,7 +24,7 @@ if [ -z "$DEST" ]; then
fi
# Set default screen title
-screen_title $DEST
+window_title $DEST
# Dispatcher
if [ "$BASENAME" == "shells" ]; then
@@ -38,11 +40,11 @@ else
wscreen $DEST
elif [ -z "$COMMAND" ] && [ "$DEST" == "root" ]; then
# Local root shell
- screen_title root
+ window_title root
sudo screen -x
elif [ "$DEST" == "local" ]; then
# Local screen shell
- screen_title $COMMAND
+ window_title $COMMAND
wscreen $COMMAND
else
# Remote shell using autossh
@@ -51,4 +53,4 @@ else
fi
# Restore screen title
-screen_title terminal
+window_title terminal