diff --git a/themes/vissi.zsh-theme b/themes/vissi.zsh-theme index 99a55b576..cd657e3ca 100644 --- a/themes/vissi.zsh-theme +++ b/themes/vissi.zsh-theme @@ -1,5 +1,23 @@ +function battery_charge { + # Battery 0: Discharging, 94%, 03:46:34 remaining + bat_percent=`acpi | awk -F ':' {'print $2;'} | awk -F ',' {'print $2;'} | sed -e "s/\s//" -e "s/%.*//"` + + if [ $bat_percent -lt 20 ]; then cl='%F{red}' + elif [ $bat_percent -lt 50 ]; then cl='%F{yellow}' + else cl='%F{green}' + fi + + filled=${(l:`expr $bat_percent / 10`::▸:)} + empty=${(l:`expr 10 - $bat_percent / 10`::▹:)} + echo $cl$filled$empty'%F{default}' +} + PROMPT='%{$fg_bold[red]%}➜ %{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}' -RPROMPT="%T %D" +if [ -x /usr/bin/acpi ]; then + RPROMPT="%T %D $(battery_charge)" +else + RPROMPT="%T %D" +fi ZSH_THEME_GIT_PROMPT_PREFIX="git:(%{$fg[red]%}" ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"