From ae144ceee851b3e463b9b72da9b0d2ce8857b40a Mon Sep 17 00:00:00 2001 From: Dylan Date: Thu, 3 Mar 2016 11:52:39 +1100 Subject: [PATCH] Added disk support to progress bars --- 1.4.md | 6 +++++- README.md | 1 + config/config | 2 ++ neofetch | 10 ++++++++++ 4 files changed, 18 insertions(+), 1 deletion(-) diff --git a/1.4.md b/1.4.md index f4fcd3b8..5e8eb969 100644 --- a/1.4.md +++ b/1.4.md @@ -26,7 +26,11 @@ the output. **Battery**
- Added support for NetBSD -- Added `--battery_bar` and `$batter_bar` to enable/disable displaying a progress bar in
+- Added `--battery_bar` and `$battery_bar` to enable/disable displaying a progress bar in
+the output. + +**Disk**:
+- Added `--disk_bar` and `$disk_bar` to enable/disable displaying a progress bar in
the output. ### Ascii diff --git a/README.md b/README.md index 0a525b21..84f9f8c5 100644 --- a/README.md +++ b/README.md @@ -288,6 +288,7 @@ alias fetch2="fetch \ --cpu_usage_bar on/off Whether or not to print a progress bar for cpu usage. --memory_bar on/off Whether or not to print a progress bar for memory usage. --battery_bar on/off Whether or not to print a progress bar for battery usage. + --disk_bar on/off Whether or not to print a progress bar for disk usage. Image: diff --git a/config/config b/config/config index a79455e3..ecf361b7 100644 --- a/config/config +++ b/config/config @@ -238,9 +238,11 @@ progress_color_total="8" # --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" # }}} diff --git a/neofetch b/neofetch index 60129981..6188f9dd 100755 --- a/neofetch +++ b/neofetch @@ -260,9 +260,11 @@ progress_color_total="8" # --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" # }}} @@ -1379,6 +1381,12 @@ getdisk () { # Put it all together disk="${disk_used} / ${disk_total} (${disk_total_per})" + + if [ "$disk_bar" == "on" ]; then + disk_used=${disk_used/T} + disk_total=${disk_total/T} + disk+=" $(bar "${disk_used/'.'}" "${disk_total/'.'}")" + fi } # }}} @@ -2361,6 +2369,7 @@ usage () { cat << EOF --cpu_usage_bar on/off Whether or not to print a progress bar for cpu usage. --memory_bar on/off Whether or not to print a progress bar for memory usage. --battery_bar on/off Whether or not to print a progress bar for battery usage. + --disk_bar on/off Whether or not to print a progress bar for disk usage. Image: @@ -2486,6 +2495,7 @@ while [ "$1" ]; do --cpu_usage_bar) cpu_usage_bar="$2" ;; --memory_bar) memory_bar="$2" ;; --battery_bar) battery_bar="$2" ;; + --disk_bar) disk_bar="$2" ;; # Image --image)