mirror of
https://github.com/romkatv/powerlevel10k.git
synced 2025-01-11 16:56:45 +01:00
add POWERLEVEL9K_BATTERY_LEVEL_FOREGROUND; fixes #256
This commit is contained in:
parent
0c59d87f08
commit
5b9e75be3a
1 changed files with 9 additions and 1 deletions
|
@ -1115,7 +1115,14 @@ prompt_battery() {
|
|||
bg=$_POWERLEVEL9K_BATTERY_LEVEL_BACKGROUND[idx]
|
||||
fi
|
||||
|
||||
_p9k_prompt_segment $0_$state "$bg" "$_p9k_battery_states[$state]" $icon 0 '' $msg
|
||||
local fg=$_p9k_battery_states[$state]
|
||||
if (( $#_POWERLEVEL9K_BATTERY_LEVEL_FOREGROUND )); then
|
||||
local -i idx=$#_POWERLEVEL9K_BATTERY_LEVEL_FOREGROUND
|
||||
(( bat_percent < 100 )) && idx=$((bat_percent * $#_POWERLEVEL9K_BATTERY_LEVEL_FOREGROUND / 100 + 1))
|
||||
fg=$_POWERLEVEL9K_BATTERY_LEVEL_FOREGROUND[idx]
|
||||
fi
|
||||
|
||||
_p9k_prompt_segment $0_$state "$bg" "$fg" $icon 0 '' $msg
|
||||
}
|
||||
|
||||
################################################################
|
||||
|
@ -3893,6 +3900,7 @@ _p9k_init_params() {
|
|||
_p9k_declare -i POWERLEVEL9K_BATTERY_LOW_THRESHOLD 10
|
||||
_p9k_declare -i POWERLEVEL9K_BATTERY_HIDE_ABOVE_THRESHOLD 999
|
||||
_p9k_declare -a POWERLEVEL9K_BATTERY_LEVEL_BACKGROUND --
|
||||
_p9k_declare -a POWERLEVEL9K_BATTERY_LEVEL_FOREGROUND --
|
||||
_p9k_declare -b POWERLEVEL9K_BATTERY_VERBOSE 1
|
||||
if [[ $parameters[POWERLEVEL9K_BATTERY_STAGES] == scalar ]]; then
|
||||
_p9k_declare -e POWERLEVEL9K_BATTERY_STAGES
|
||||
|
|
Loading…
Reference in a new issue