From 6485476ae7872590d639494531d944c57b966660 Mon Sep 17 00:00:00 2001 From: Dylan Date: Sun, 13 Mar 2016 08:37:33 +1100 Subject: [PATCH] Various progress bar fixes --- config/config | 33 ++++++++++++++------------------ neofetch | 53 +++++++++++++++++---------------------------------- 2 files changed, 32 insertions(+), 54 deletions(-) diff --git a/config/config b/config/config index 80fbdc6b..813ed8cc 100644 --- a/config/config +++ b/config/config @@ -234,26 +234,21 @@ progress_length="15" progress_color_elapsed="6" progress_color_total="8" -# Enable/Disable progress bars -# --cpu_usage_bar on/off -# --memory_bar on/off -# --battery_bar on/off -# --disk_bar on/off -cpu_usage_bar="off" -memory_bar="off" -battery_bar="off" -disk_bar="off" +# Customize how the info is displayed. +# bar: Only the progress bar is displayed. +# infobar: The bar is displayed after the info. +# barinfo: The bar is displayed before the info. +# off: Only the info is displayed. +# +# --cpu_displau bar/infobar/barinfo/off +# --memory_display bar/infobar/barinfo/off +# --battery_display bar/infobar/barinfo/off +# --disk_display bar/infobar/barinfo/off +cpu_display="off" +memory_display="off" +battery_display="off" +disk_display="off" -# Enable/Disable showing just the bar on its own. -# Set this to 'off' to only show the progress bar. -# --cpu_usage_info on/off -# --memory_info on/off -# --battery_info on/off -# --disk_info on/off -cpu_usage_info="on" -memory_info="on" -battery_info="on" -disk_info="on" # }}} diff --git a/neofetch b/neofetch index 4dea730d..847bcc17 100755 --- a/neofetch +++ b/neofetch @@ -262,10 +262,17 @@ progress_length="15" progress_color_elapsed="6" progress_color_total="8" -# Enable/Disable progress bars -# --memory_bar bar/infobar/barinfo/off -# --battery_bar bar/infobar/barinfo/off -# --disk_bar bar/infobar/barinfo/off +# Customize how the info is displayed. +# bar: Only the progress bar is displayed. +# infobar: The bar is displayed after the info. +# barinfo: The bar is displayed before the info. +# off: Only the info is displayed. +# +# --cpu_displau bar/infobar/barinfo/off +# --memory_display bar/infobar/barinfo/off +# --battery_display bar/infobar/barinfo/off +# --disk_display bar/infobar/barinfo/off +cpu_display="off" memory_display="off" battery_display="off" disk_display="off" @@ -899,19 +906,17 @@ getcpu () { esac # Add CPU info bar - prin "${subtitle}: ${cpu}" cpu_usage="$(ps aux | awk 'BEGIN { sum = 0 } { sum += $3 }; END { print sum }')" cpu_usage="${cpu_usage/\.*}%" case "$cpu_display" in - "info") prin "CPU Usage: ${cpu_usage}" ;; - "bar") prin "CPU Usage: $(bar "${cpu_usage/'%'}" 100)" ;; - "infobar") prin "CPU Usage: ${cpu_usage} $(bar "${cpu_usage/'%'}" 100)" ;; - "barinfo") prin "CPU Usage: $(bar "${cpu_usage/'%'}" 100) ${cpu_usage}" ;; + "info") prin "${subtitle} Usage: ${cpu_usage}" ;; + "bar") prin "${subtitle} Usage: $(bar "${cpu_usage/'%'}" 100)" ;; + "infobar") prin "${subtitle} Usage: ${cpu_usage} $(bar "${cpu_usage/'%'}" 100)" ;; + "barinfo") prin "${subtitle} Usage: $(bar "${cpu_usage/'%'}" 100) ${cpu_usage}" ;; esac - unset cpu } @@ -1470,16 +1475,11 @@ getbattery () { else if [ "${#batteries[@]}" -gt 1 ]; then + unset battery + # Print each battery on a separate line. for bat in "${batteries[@]}"; do - battery="${title}${index}: ${bat}%" - - [ "$battery_bar" == "on" ] && \ - battery+=" $(bar $bat 100)" - - prin "$battery" - unset battery - index=$((index + 1)) + prin "${title}${index}: ${bat}%" done return fi @@ -1669,23 +1669,6 @@ getcols () { fi } -# }}} - -# CPU Usage {{{ - -getcpu_usage () { - cpu_usage="$(ps aux | awk 'BEGIN { sum = 0 } { sum += $3 }; END { print sum }')" - cpu_usage="${cpu_usage/\.*}%" - - if [ "$cpu_usage_bar" == "on" ]; then - case "$cpu_usage_info" in - "off") cpu_usage="$(bar "${cpu_usage/'%'}" 100)" ;; - *) cpu_usage+=" $(bar "${cpu_usage/'%'}" 100)" ;; - esac - fi -} - - # }}} # }}}