aboutsummaryrefslogtreecommitdiff
path: root/powerlevel9k.zsh-theme
diff options
context:
space:
mode:
authorDominik Ritter <dritter03@googlemail.com>2015-09-26 13:51:08 +0300
committerDominik Ritter <dritter03@googlemail.com>2015-09-26 13:51:08 +0300
commit6d24f93760d866feceda8750a115e19beb6250b1 (patch)
tree596bba68c4a182a302faf29491c59b06f67bf4c1 /powerlevel9k.zsh-theme
parentf52a7f25701a42bda48be32e0649c86dd291fbb2 (diff)
Alphabetical order.
Diffstat (limited to 'powerlevel9k.zsh-theme')
-rw-r--r--powerlevel9k.zsh-theme87
1 files changed, 44 insertions, 43 deletions
diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme
index c707923e..b48bce4b 100644
--- a/powerlevel9k.zsh-theme
+++ b/powerlevel9k.zsh-theme
@@ -678,49 +678,6 @@ prompt_load() {
"$1_prompt_segment" "$0$FUNCTION_SUFFIX" "$BACKGROUND_COLOR" "$DEFAULT_COLOR" "$(print_icon 'LOAD_ICON') $load_avg_5min"
}
-prompt_ram() {
- defined POWERLEVEL9K_RAM_ELEMENTS || POWERLEVEL9K_RAM_ELEMENTS=(ram_free swap_used)
-
- local rendition base
- for element in "${POWERLEVEL9K_RAM_ELEMENTS[@]}"; do
- case $element in
- ram_free)
- if [[ "$OS" == "OSX" ]]; then
- ramfree=$(vm_stat | grep "Pages free" | grep -o -E '[0-9]+')
- # Convert pages into Bytes
- ramfree=$(( ramfree * 4096 ))
- base=''
- else
- ramfree=$(grep -o -E "MemFree:\s+[0-9]+" /proc/meminfo | grep -o "[0-9]*")
- base=K
- fi
-
- rendition+="$(print_icon 'RAM_ICON') $(printSizeHumanReadable "$ramfree" $base) "
- ;;
- swap_used)
- if [[ "$OS" == "OSX" ]]; then
- raw_swap_used=$(sysctl vm.swapusage | grep -o "used\s*=\s*[0-9,.A-Z]*" | grep -o "[0-9,.A-Z]*$")
- typeset -F 2 swap_used
- swap_used=${$(echo $raw_swap_used | grep -o "[0-9,.]*")//,/.}
- # Replace comma
- swap_used=${swap_used//,/.}
-
- base=$(echo "$raw_swap_used" | grep -o "[A-Z]*$")
- else
- swap_total=$(grep -o -E "SwapTotal:\s+[0-9]+" /proc/meminfo | grep -o "[0-9]*")
- swap_free=$(grep -o -E "SwapFree:\s+[0-9]+" /proc/meminfo | grep -o "[0-9]*")
- swap_used=$(( swap_total - swap_free ))
- base=K
- fi
-
- rendition+="$(printSizeHumanReadable "$swap_used" $base) "
- ;;
- esac
- done
-
- "$1_prompt_segment" "$0" "yellow" "$DEFAULT_COLOR" "${rendition% }"
-}
-
# Right Status: (return code, root status, background jobs)
# This creates a status segment for the *right* prompt. Exact same thing as
# above - just other side.
@@ -766,6 +723,50 @@ prompt_php_version() {
fi
}
+# Show free RAM and used Swap
+prompt_ram() {
+ defined POWERLEVEL9K_RAM_ELEMENTS || POWERLEVEL9K_RAM_ELEMENTS=(ram_free swap_used)
+
+ local rendition base
+ for element in "${POWERLEVEL9K_RAM_ELEMENTS[@]}"; do
+ case $element in
+ ram_free)
+ if [[ "$OS" == "OSX" ]]; then
+ ramfree=$(vm_stat | grep "Pages free" | grep -o -E '[0-9]+')
+ # Convert pages into Bytes
+ ramfree=$(( ramfree * 4096 ))
+ base=''
+ else
+ ramfree=$(grep -o -E "MemFree:\s+[0-9]+" /proc/meminfo | grep -o "[0-9]*")
+ base=K
+ fi
+
+ rendition+="$(print_icon 'RAM_ICON') $(printSizeHumanReadable "$ramfree" $base) "
+ ;;
+ swap_used)
+ if [[ "$OS" == "OSX" ]]; then
+ raw_swap_used=$(sysctl vm.swapusage | grep -o "used\s*=\s*[0-9,.A-Z]*" | grep -o "[0-9,.A-Z]*$")
+ typeset -F 2 swap_used
+ swap_used=${$(echo $raw_swap_used | grep -o "[0-9,.]*")//,/.}
+ # Replace comma
+ swap_used=${swap_used//,/.}
+
+ base=$(echo "$raw_swap_used" | grep -o "[A-Z]*$")
+ else
+ swap_total=$(grep -o -E "SwapTotal:\s+[0-9]+" /proc/meminfo | grep -o "[0-9]*")
+ swap_free=$(grep -o -E "SwapFree:\s+[0-9]+" /proc/meminfo | grep -o "[0-9]*")
+ swap_used=$(( swap_total - swap_free ))
+ base=K
+ fi
+
+ rendition+="$(printSizeHumanReadable "$swap_used" $base) "
+ ;;
+ esac
+ done
+
+ "$1_prompt_segment" "$0" "yellow" "$DEFAULT_COLOR" "${rendition% }"
+}
+
# rbenv information
prompt_rbenv() {
if [[ -n "$RBENV_VERSION" ]]; then