Skip to content

Commit

Permalink
-Fix: set window and pane titles with tmux as well as screen
Browse files Browse the repository at this point in the history
  • Loading branch information
Juhász Péter committed Oct 19, 2013
1 parent 4d0632f commit a19d810
Showing 1 changed file with 29 additions and 25 deletions.
54 changes: 29 additions & 25 deletions git-prompt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -322,40 +322,44 @@ cwd_truncate() {
set_shell_label() {

xterm_label() {
local args="$*"
printf "\033]0;%s\033\\" "${args:0:200}"
local args="$*"
printf "\033]0;%s\033\\" "${args:0:200}"
}

screen_label() {
local param
param="$plain_who_where $@"
# workaround screen UTF-8 bug
param=${param//$ellipse_marker/$ellipse_marker_plain}
local param full
full="$plain_who_where $@"
param="$*"

# FIXME $STY not inherited though "su -"
if [[ "$STY" ]]; then
# workaround screen UTF-8 bug
param=${param//$ellipse_marker/$ellipse_marker_plain}
full=${full//$ellipse_marker/$ellipse_marker_plain}
fi

# FIXME: run this only if screen is in xterm (how to test for this?)
xterm_label "$param"
# FIXME: run this only if screen is in xterm (how to test for this?)
xterm_label "$full"

# FIXME $STY not inherited though "su -"
[ "$STY" ] && screen -S $STY -X title "$*"
printf "\033k%s\033\\" "$param"
}
if [[ -n "$STY" ]]; then
screen_label "$*"
else
case $TERM in

screen*)
screen_label "$*"
;;
if [[ -n "$STY" || -n "$TMUX" ]]; then
screen_label "$*"
else
case $TERM in
screen*)
screen_label "$*"
;;

xterm* | rxvt* | gnome-* | konsole | eterm | wterm )
# is there a capability which we can to test
# for "set term title-bar" and its escapes?
xterm_label "$plain_who_where $@"
;;
xterm* | rxvt* | gnome-* | konsole | eterm | wterm )
# is there a capability which we can to test
# for "set term title-bar" and its escapes?
xterm_label "$plain_who_where $@"
;;

*)
;;
esac
*) ;;
esac
fi
}

Expand Down

0 comments on commit a19d810

Please sign in to comment.