mirror of
https://github.com/arcan1s/dotfiles.git
synced 2025-04-24 16:07:17 +00:00
update prompt
This commit is contained in:
parent
75abc06b6c
commit
970546855b
22
zsh/prompt
22
zsh/prompt
@ -19,15 +19,23 @@ fi
|
|||||||
precmd() {
|
precmd() {
|
||||||
# battery charge
|
# battery charge
|
||||||
function batcharge {
|
function batcharge {
|
||||||
bat_perc=$(acpi | awk {'print $4;'} | sed -e "s/\s//" -e "s/%.*//")
|
local _bat_perc=0
|
||||||
if [[ ${bat_perc} < 15 ]]; then
|
local _num=0
|
||||||
col="%{$fg_bold[red]%}"
|
local _bat
|
||||||
elif [[ ${bat_perc} < 50 ]]; then
|
for _bat in /sys/class/power_supply/BAT*; do
|
||||||
col="%{$fg_bold[yellow]%}"
|
let "_bat_perc += $(cat ${_bat}/capacity)"
|
||||||
|
let "_num += 1"
|
||||||
|
done
|
||||||
|
_bat_perc=$((${_bat_perc}/${_num}))
|
||||||
|
local _col
|
||||||
|
if [[ ${_bat_perc} < 15 ]]; then
|
||||||
|
_col="%{$fg_bold[red]%}"
|
||||||
|
elif [[ ${_bat_perc} < 50 ]]; then
|
||||||
|
_col="%{$fg_bold[yellow]%}"
|
||||||
else
|
else
|
||||||
col="%{$fg_bold[green]%}"
|
_col="%{$fg_bold[green]%}"
|
||||||
fi
|
fi
|
||||||
echo "%{$fg_bold[white]%}["$col$bat_perc"%{$fg_bold[white]%}%%]%{$reset_color%}"
|
echo "%{$fg_bold[white]%}["${_col}${_bat_perc}"%{$fg_bold[white]%}%%]%{$reset_color%}"
|
||||||
}
|
}
|
||||||
# last command
|
# last command
|
||||||
returncode="%(?.%{$fg[green]%}.%{$fg[red]%})%?%{$resetcolor%}"
|
returncode="%(?.%{$fg[green]%}.%{$fg[red]%})%?%{$resetcolor%}"
|
||||||
|
Loading…
Reference in New Issue
Block a user