From ef783206324a9c48cc2c695eef3974c452ac1ed1 Mon Sep 17 00:00:00 2001 From: Peter Hoeg Date: Thu, 29 Sep 2011 17:13:40 +0800 Subject: [PATCH 1/2] add: battery plugin --- plugins/battery/battery.plugin.zsh | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 plugins/battery/battery.plugin.zsh diff --git a/plugins/battery/battery.plugin.zsh b/plugins/battery/battery.plugin.zsh new file mode 100644 index 000000000..c1cab9ec3 --- /dev/null +++ b/plugins/battery/battery.plugin.zsh @@ -0,0 +1,9 @@ +if [[ $(acpi | grep -c ^Battery) -gt 0 ]] ; then + function battery_pct_remaining() { echo "$(acpi | cut -f2 -d ',' | tr -cd '[:digit:]')" } + function battery_time_remaining() { echo $(acpi | cut -f3 -d ',') } + function battery_pct_prompt() { echo "%{$fg[red]%}[$(battery_pct_remaining)]%{$reset_color%}" } +else + error_msg='no battery' + function battery_pct_remaining() { echo $error_msg } + function battery_time_remaining() { echo $error_msg } +fi From 1189065aed11d043ef46ec9fdb938f4f2592d0c1 Mon Sep 17 00:00:00 2001 From: Peter Hoeg Date: Thu, 29 Sep 2011 17:13:57 +0800 Subject: [PATCH 2/2] updated theme that does not check for dirty git working dirs --- themes/peterhoeg.zsh-theme | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/themes/peterhoeg.zsh-theme b/themes/peterhoeg.zsh-theme index f52f6510b..804b937d9 100644 --- a/themes/peterhoeg.zsh-theme +++ b/themes/peterhoeg.zsh-theme @@ -3,15 +3,16 @@ ZSH_THEME_GIT_PROMPT_SUFFIX="]%{$reset_color%}" ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%}*%{$reset_color%}" ZSH_THEME_GIT_PROMPT_CLEAN="" -#Customized git status, oh-my-zsh currently does not allow render dirty status before branch git_custom_status() { local cb=$(current_branch) if [ -n "$cb" ]; then - echo "$(parse_git_dirty)$ZSH_THEME_GIT_PROMPT_PREFIX$(current_branch)$ZSH_THEME_GIT_PROMPT_SUFFIX" + echo "%{$fg[green]%}[$(current_branch)]%{$reset_color%}" + #Customized git status, oh-my-zsh currently does not allow render dirty status before branch + # echo "$(parse_git_dirty)$ZSH_THEME_GIT_PROMPT_PREFIX$(current_branch)$ZSH_THEME_GIT_PROMPT_SUFFIX" fi } -#rbenv and git settings -RPS1='$(git_custom_status)%{$fg[red]%}[`rbenv_prompt_info`]%{$reset_color%} $EPS1' +#git and rbenv +RPS1='$(git_custom_status)[`rbenv_prompt_info`]`battery_pct_prompt` $EPS1' PROMPT='%{$fg[cyan]%}[%~% ]%(?.%{$fg[green]%}.%{$fg[red]%})%B$%b '