From 6c6fa04b79902363af3b049fb8a749b40eafcc9b Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Thu, 16 Oct 2014 11:09:01 -0300 Subject: Restore term title --- shell | 14 ++++++++------ 1 file 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 -- cgit v1.2.3