From 6efad291f4cdaf77081a62b3db3075959eff3170 Mon Sep 17 00:00:00 2001 From: Milind Shakya Date: Thu, 12 Apr 2012 17:16:48 -0500 Subject: [PATCH] added my version of pygmalion that has battery status info --- themes/pygmalion-batt.zsh-theme | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 themes/pygmalion-batt.zsh-theme diff --git a/themes/pygmalion-batt.zsh-theme b/themes/pygmalion-batt.zsh-theme new file mode 100644 index 000000000..73aff1fd0 --- /dev/null +++ b/themes/pygmalion-batt.zsh-theme @@ -0,0 +1,30 @@ +# Yay! High voltage and arrows! + +ZSH_THEME_GIT_PROMPT_PREFIX="%{$reset_color%}%{$fg[green]%}" +ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} " +ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[yellow]%} ⚡%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_CLEAN="" + +setprompt(){ +if which acpi &> /dev/null; then + local BATTSTATE="$(acpi -b)" + local BATTPRCNT="$(echo ${BATTSTATE[(w)4]}|sed -r 's/(^[0-9]+).*/\1/')" + if [[ -z "${BATTPRCNT}" ]]; then + PR_BATTERY="" + elif [[ "${BATTPRCNT}" -lt 15 ]]; then + PR_BATTERY="${fg[red]} batt:${BATTPRCNT}%%" + elif [[ "${BATTPRCNT}" -lt 60 ]]; then + PR_BATTERY="${fg[yellow]} batt:${BATTPRCNT}%%" + elif [[ "${BATTPRCNT}" -lt 96 ]]; then + PR_BATTERY="${fg[green]} batt:${BATTPRCNT}%%" + else + PR_BATTERY="" + fi + fi + +PROMPT='$fg[magenta]%}%n%{$reset_color%}%{$fg[cyan]%}@%{$reset_color%}%{$fg[yellow]%}%m%{$reset_color%}%{$fg[red]%}:%{$reset_color%}%{$fg[cyan]%}%0~%{$reset_color%}%{$fg[red]%}|${PR_BATTERY%}%{$reset_color%}%{$fg[red]%}|%{$reset_color%}$(git_prompt_info)%{$fg[cyan]%}⇒%{$reset_color%} ' +} + + precmd() { PS1= setprompt } + + setprompt