|
|
@ -340,9 +340,15 @@ prompt_background_jobs() {
|
|
|
|
# Segment to indicate hdd available level.
|
|
|
|
# Segment to indicate hdd available level.
|
|
|
|
prompt_hdd_usage() {
|
|
|
|
prompt_hdd_usage() {
|
|
|
|
local current_state="unknown"
|
|
|
|
local current_state="unknown"
|
|
|
|
typeset -AH hdd_usage_states
|
|
|
|
typeset -AH hdd_usage_forecolors
|
|
|
|
hdd_usage_states=(
|
|
|
|
hdd_usage_forecolors=(
|
|
|
|
'normal' 'green'
|
|
|
|
'normal' 'yellow'
|
|
|
|
|
|
|
|
'warning' "$DEFAULT_COLOR"
|
|
|
|
|
|
|
|
'critical' 'white'
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
typeset -AH hdd_usage_backcolors
|
|
|
|
|
|
|
|
hdd_usage_backcolors=(
|
|
|
|
|
|
|
|
'normal' $DEFAULT_COLOR
|
|
|
|
'warning' 'yellow'
|
|
|
|
'warning' 'yellow'
|
|
|
|
'critical' 'red'
|
|
|
|
'critical' 'red'
|
|
|
|
)
|
|
|
|
)
|
|
|
@ -366,18 +372,20 @@ prompt_hdd_usage() {
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
current_state='normal'
|
|
|
|
current_state='normal'
|
|
|
|
|
|
|
|
local message="$level%"
|
|
|
|
|
|
|
|
|
|
|
|
if [ $level -le $POWERLEVEL9K_HDD_USAGE_WARNING_LEVEL ]; then
|
|
|
|
if [ $level -le $POWERLEVEL9K_HDD_USAGE_WARNING_LEVEL ]; then
|
|
|
|
current_state='warning'
|
|
|
|
current_state='warning'
|
|
|
|
|
|
|
|
message="$message left"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
if [ $level -le $POWERLEVEL9K_HDD_USAGE_CRITICAL_LEVEL ]; then
|
|
|
|
if [ $level -le $POWERLEVEL9K_HDD_USAGE_CRITICAL_LEVEL ]; then
|
|
|
|
current_state='critical'
|
|
|
|
current_state='critical'
|
|
|
|
|
|
|
|
message="$message left"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
local message="$level"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Draw the prompt_segment
|
|
|
|
# Draw the prompt_segment
|
|
|
|
if [[ -n $level ]]; then
|
|
|
|
if [[ -n $level ]]; then
|
|
|
|
"$1_prompt_segment" "${0}_${current_state}" "$2" "$DEFAULT_COLOR" "${hdd_usage_states[$current_state]}" "$message" 'HDD_ICON'
|
|
|
|
"$1_prompt_segment" "${0}_${current_state}" "$2" "${hdd_usage_backcolors[$current_state]}" "${hdd_usage_forecolors[$current_state]}" "$message" 'HDD_ICON'
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|