summaryrefslogtreecommitdiff
path: root/01_Functions.zsh
diff options
context:
space:
mode:
authorHugues Hiegel <hugues@hiegel.fr>2009-11-20 23:48:10 +0100
committerHugues Hiegel <hugues@hiegel.fr>2009-11-20 23:48:10 +0100
commita85e0a0cdbd2048fec0eb70110d6c8defd2ee367 (patch)
tree2401f6492c001af15c9d9e25b387c204bf313c54 /01_Functions.zsh
parenta4cce3f96ef3cc0169a3f2147866309fdaab84c9 (diff)
[Funcs] Adapts term_title for Tmux
Diffstat (limited to '01_Functions.zsh')
-rw-r--r--01_Functions.zsh33
1 files changed, 21 insertions, 12 deletions
diff --git a/01_Functions.zsh b/01_Functions.zsh
index 7a1fbd2..2f19d07 100644
--- a/01_Functions.zsh
+++ b/01_Functions.zsh
@@ -32,15 +32,16 @@ term_title()
lastjob=$(ps ft `tty` | grep "[0-9]\+[[:blank:]]\+`tty | sed 's/\/dev\///'`[[:blank:]]\+T.\? \+.:.. \\\_ " | tail -n1 | cut -c32-)
set "$lastjob"
fi
- if [ "$command[0]" = "screen" ]
+ if [ "$command[0]" = "screen" -o "$command[0]" = "tmux" ]
then
# discards screen args
- set "screen"
+ set $command[0]
fi
[ ! "$@" = "" ] && set " |" $@
- [[ -t 1 ]] &&
+ if [[ -t 1 ]]
+ then
case $TERM in
sun-cmd)
print -Pn "\e]l%n@%m %~$@\e\\" # Never tested..
@@ -49,20 +50,28 @@ term_title()
print -Pn "\e]0;%n@%m (%l) %~$@\a" # Sets term title
;;
screen*)
- local _sep=""
+ local _sep=""
[ $# -gt 0 ] && _sep=$1 && shift # gets and discards the separator, if any.
- # hardstatus
- #print -Pn "\e]2;{+b W}SCREEN #n {-b W}| {R}?u(u) ?{W}{r}%n@%m{W} ({c}%l{W}) {R}%~{W}${_sep:+$_sep \{+b Y\}}$@{-b W}\a" # Sets hardstatus line (term title)
- print -Pn "\e]2;{R}?u(u) ?{W}{r}%n{R}@{r}%m{-b W} ({+b c}%l{-b W}) {R}%~{W}${_sep:+$_sep \{+b Y\}}$@{-b W}\a" # Sets hardstatus line (term title)
- # caption
- print -Pn "\ek"
- [ "$SUDO_USER" != "" ] && print -Pn "($USER) "
- print -Pn "${@:-%~}"
- print -Pn "\e\\"
+ if [ ! -z "$TMUX" ]
+ then
+ # Tmux
+ print -Pn "\e]0;%n@%m (%l) %~${_sep:+$_sep #[fg=yellow,bold]}$@\a" # Sets term title
+ else
+ # Classic screen
+ # hardstatus
+ #print -Pn "\e]2;{+b W}SCREEN #n {-b W}| {R}?u(u) ?{W}{r}%n@%m{W} ({c}%l{W}) {R}%~{W}${_sep:+$_sep \{+b Y\}}$@{-b W}\a" # Sets hardstatus line (term title)
+ print -Pn "\e]2;{R}?u(u) ?{W}{r}%n{R}@{r}%m{-b W} ({+b c}%l{-b W}) {R}%~{W}${_sep:+$_sep \{+b Y\}}$@{-b W}\a" # Sets hardstatus line (term title)
+ # caption
+ print -Pn "\ek"
+ [ "$SUDO_USER" != "" ] && print -Pn "($USER) "
+ print -Pn "${@:-%~}"
+ print -Pn "\e\\"
+ fi
;;
*)
;;
esac
+ fi
}
preprint()