aboutsummaryrefslogtreecommitdiff
path: root/powerlevel9k.zsh-theme
diff options
context:
space:
mode:
authorBen Hilburn <bhilburn@gmail.com>2017-01-22 05:34:55 +0300
committerBen Hilburn <bhilburn@gmail.com>2017-01-22 05:34:55 +0300
commit7bd2585371cc28a460543f8ef37c9f93c0d188df (patch)
tree6c8c3d1bd8cf9a30d05a47251fc60fc55882c1f0 /powerlevel9k.zsh-theme
parent64afe83cbd368d45c0ab23c05636b426230fcb57 (diff)
incorportaing feedback from review on `hdd_usage` segment
Diffstat (limited to 'powerlevel9k.zsh-theme')
-rwxr-xr-xpowerlevel9k.zsh-theme23
1 files changed, 12 insertions, 11 deletions
diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme
index ec4c60c3..f2e32582 100755
--- a/powerlevel9k.zsh-theme
+++ b/powerlevel9k.zsh-theme
@@ -338,10 +338,10 @@ prompt_background_jobs() {
}
# Segment that indicates usage level of current partition.
-set_default POWERLEVEL9K_HDD_USAGE_ONLY_WARNING false
-set_default POWERLEVEL9K_HDD_USAGE_WARNING_LEVEL 90
-set_default POWERLEVEL9K_HDD_USAGE_CRITICAL_LEVEL 95
-prompt_hdd_usage() {
+set_default POWERLEVEL9K_DISK_USAGE_ONLY_WARNING false
+set_default POWERLEVEL9K_DISK_USAGE_WARNING_LEVEL 90
+set_default POWERLEVEL9K_DISK_USAGE_CRITICAL_LEVEL 95
+prompt_disk_usage() {
local current_state="unknown"
typeset -AH hdd_usage_forecolors
hdd_usage_forecolors=(
@@ -356,25 +356,26 @@ prompt_hdd_usage() {
'critical' 'red'
)
- local level="${$(df -k . | sed -n '2p' | awk '{ print $5 }')%%\%}"
+ local disk_usage="${$(\df -P . | sed -n '2p' | awk '{ print $5 }')%%\%}"
- if [ "$level" -ge "$POWERLEVEL9K_HDD_USAGE_WARNING_LEVEL" ]; then
+ if [ "$disk_usage" -ge "$POWERLEVEL9K_DISK_USAGE_WARNING_LEVEL" ]; then
current_state='warning'
- if [ "$level" -ge "$POWERLEVEL9K_HDD_USAGE_CRITICAL_LEVEL" ]; then
+ if [ "$disk_usage" -ge "$POWERLEVEL9K_DISK_USAGE_CRITICAL_LEVEL" ]; then
current_state='critical'
fi
else
- if [[ "$POWERLEVEL9K_HDD_USAGE_ONLY_WARNING" != false ]]; then
+ if [[ "$POWERLEVEL9K_DISK_USAGE_ONLY_WARNING" == true ]]; then
+ current_state=''
return
fi
current_state='normal'
fi
- local message="${level}%%"
+ local message="${disk_usage}%%"
# Draw the prompt_segment
- if [[ -n $level ]]; then
- "$1_prompt_segment" "${0}_${current_state}" "$2" "${hdd_usage_backcolors[$current_state]}" "${hdd_usage_forecolors[$current_state]}" "$message" 'HDD_ICON'
+ if [[ -n $disk_usage ]]; then
+ "$1_prompt_segment" "${0}_${current_state}" "$2" "${hdd_usage_backcolors[$current_state]}" "${hdd_usage_forecolors[$current_state]}" "$message" 'DISK_ICON'
fi
}