about summary refs log tree commit diff
path: root/Functions
diff options
context:
space:
mode:
authorClint Adams <clint@users.sourceforge.net>2002-02-09 21:06:13 +0000
committerClint Adams <clint@users.sourceforge.net>2002-02-09 21:06:13 +0000
commit50758ce645d3c0e9c0e3d18e96c13638537cd4f6 (patch)
tree4c3588a65aa6c4d2800cdff60e002260e912747b /Functions
parentf50dfba2f26a90966a53ba9a8cd43f322ba0a14c (diff)
downloadzsh-50758ce645d3c0e9c0e3d18e96c13638537cd4f6.tar.gz
zsh-50758ce645d3c0e9c0e3d18e96c13638537cd4f6.tar.xz
zsh-50758ce645d3c0e9c0e3d18e96c13638537cd4f6.zip
unposted: improve apm and screen handling
Diffstat (limited to 'Functions')
-rw-r--r--Functions/Prompts/prompt_clint_setup14
1 files changed, 10 insertions, 4 deletions
diff --git a/Functions/Prompts/prompt_clint_setup b/Functions/Prompts/prompt_clint_setup
index 4b002586e..d6c5d71fb 100644
--- a/Functions/Prompts/prompt_clint_setup
+++ b/Functions/Prompts/prompt_clint_setup
@@ -13,7 +13,7 @@ EOF
 prompt_clint_setup () {
   local -a pcc
   local -A pc
-  local p_date p_tty p_plat p_ver p_userpwd p_apm p_shlvlhist p_rc p_end
+  local p_date p_tty p_plat p_ver p_userpwd p_apm p_shlvlhist p_rc p_end p_win
 
   pcc[1]=${1:-'red'}
   pcc[2]=${2:-'cyan'}
@@ -25,13 +25,17 @@ prompt_clint_setup () {
   pc['\]']="%{$fg_no_bold[$pcc[1]]%}]"
   pc['<']="%{$fg_no_bold[$pcc[1]]%}<"
   pc['>']="%{$fg_no_bold[$pcc[1]]%}>"
+  pc['\(']="%{$fg_no_bold[$pcc[1]]%}("
+  pc['\)']="%{$fg_no_bold[$pcc[1]]%})"
 
   p_date="$pc['\[']%{$fg_no_bold[$pcc[2]]%}%D{%a %y/%m/%d %R %Z}$pc['\]']"
   p_tty="$pc['\[']%{$fg_no_bold[$pcc[3]]%}%l$pc['\]']"
   p_plat="$pc['\[']%{$fg_no_bold[$pcc[2]]%}${MACHTYPE}/${OSTYPE}/$(uname -r)$pc['\]']"
   p_ver="$pc['\[']%{$fg_no_bold[$pcc[2]]%}${ZSH_VERSION}$pc['\]']"
 
-  p_userpwd="$pc['<']%{$fg_no_bold[$pcc[3]]%}%n@%m%{$fg_bold[$pcc[5]]%}:%{$fg_no_bold[$pcc[4]]%}%~$pc['>']"
+  [[ -n "$WINDOW" ]] && p_win="$pc['\(']%{$fg_bold[$pcc[4]]%}$WINDOW$pc['\)']"
+
+  p_userpwd="$pc['<']%{$fg_no_bold[$pcc[3]]%}%n@%m$p_win%{$fg_bold[$pcc[5]]%}:%{$fg_no_bold[$pcc[4]]%}%~$pc['>']"
   [[ -f /proc/apm ]] && p_apm="%(2v.-%2v-.)"
 
   p_shlvlhist="%{$reset_color%}zsh%(2L./$SHLVL.) %B%h%b "
@@ -64,10 +68,12 @@ prompt_clint_precmd () {
 
 prompt_clint_apm_precmd () {
   setopt noxtrace localoptions
-  local bat
+  local bat ac
 
   bat=${${="$(</proc/apm)"}[7]/%/%%}
-  [[ $bat == ("100%"|"-1%") ]] && psvar[2]=() || psvar[2]=$bat
+  [[ ${${="$(</proc/apm)"}[4]} == "0x01" ]] && ac="AC+"
+
+  [[ $bat == ("100%"|"-1%") ]] && psvar[2]=() || psvar[2]="$ac$bat"
 }
 
 prompt_clint_setup "$@"