From 3fb92fb9b55b3f1c1372b539f898ad7cf2bf7907 Mon Sep 17 00:00:00 2001 From: Hugues Hiegel Date: Thu, 26 Mar 2015 11:24:01 +0100 Subject: [tmux][screen] termcaps, titles, prompt colors.. --- 01_Internal.zsh | 34 ++++++++++++++++++---------------- 10_Environment.zsh | 6 +++--- 12_Prompts.zsh | 9 ++++++++- 3 files changed, 29 insertions(+), 20 deletions(-) diff --git a/01_Internal.zsh b/01_Internal.zsh index eafc0a4..844823c 100644 --- a/01_Internal.zsh +++ b/01_Internal.zsh @@ -57,22 +57,24 @@ __term_title() screen*) local _sep="" [ $# -gt 0 ] && _sep=$1 && shift # gets and discards the separator, if any. - #if [ ! -z "$TMUX" ] - #then - # Tmux - #print -Pn "\e]0;%n@%m (%l) %~${_sep:+$_sep #[fg=yellow,bold]}$@\a" # Sets term title - print -Pn "\e]0;#[fg=red]%n#[fg=default,bold]@#[fg=red]%m#[default] (#[fg=cyan]%l#[fg=default]) #[fg=red]%~${_sep:+#[default,fg=default]$_sep #[fg=yellow,bold]}$(echo $@|sed 's/%/%%/g')\a" - #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 + # Tmux + #print -Pn "\e]0;%n@%m (%l) %~${_sep:+$_sep #[fg=yellow,bold]}$@\a" # Sets term title + case $(_process_tree) in + *":: tmux ::"*) + print -Pn "\e]0;#[fg=red]%n#[fg=default,bold]@#[fg=red]%m#[default] (#[fg=cyan]%l#[fg=default]) #[fg=red]%~${_sep:+#[default,fg=default]$_sep #[fg=yellow,bold]}$(echo $@|sed 's/%/%%/g')\a" + ;; + *":: SCREEN ::"*) + # 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\\" + ;; + esac ;; *) ;; diff --git a/10_Environment.zsh b/10_Environment.zsh index 10c3f0f..c793d3c 100644 --- a/10_Environment.zsh +++ b/10_Environment.zsh @@ -28,11 +28,11 @@ _C="$_c%}" unset has_termcaps case "$( _process_tree )" in - *"screen ::"*) + *":: SCREEN ::"*) # Discards termcaps even if screen is launched from an urxvt.. ;; - *"urxvt ::"*|\ - *"tmux ::"*) + *":: "*"urxvt ::"*|\ + *":: tmux ::"*) has_termcaps="true" ;; *) diff --git a/12_Prompts.zsh b/12_Prompts.zsh index d49b947..3b4ef52 100644 --- a/12_Prompts.zsh +++ b/12_Prompts.zsh @@ -19,7 +19,14 @@ then _prompt_colors[generic]=${PS1_YEAH} fi -__set_prompt_colors +case "$( _process_tree )" in + *":: SCREEN ::"*) + __set_prompt_colors "38;5;124" + ;; + *) + __set_prompt_colors + ;; +esac ## Prompts # -- cgit v1.2.3