Merge pull request #141 from iandrewt/progress_bars_fixes
Progress bars fixes
This commit is contained in:
commit
77cd07b7cb
1 changed files with 86 additions and 52 deletions
138
neofetch
138
neofetch
|
@ -115,6 +115,12 @@ shell_version="off"
|
||||||
# scaling_current, scaling_min, scaling_max
|
# scaling_current, scaling_min, scaling_max
|
||||||
speed_type="max"
|
speed_type="max"
|
||||||
|
|
||||||
|
# CPU Display
|
||||||
|
# Set shorthand setting and progress bar setting
|
||||||
|
# --cpu_display (name, speed, tiny, on, off) (bar, infobar, barinfo, off)
|
||||||
|
cpu_shorthand="off"
|
||||||
|
cpu_display="off"
|
||||||
|
|
||||||
|
|
||||||
# GPU
|
# GPU
|
||||||
|
|
||||||
|
@ -257,25 +263,13 @@ progress_color_elapsed="6"
|
||||||
progress_color_total="8"
|
progress_color_total="8"
|
||||||
|
|
||||||
# Enable/Disable progress bars
|
# Enable/Disable progress bars
|
||||||
# --cpu_usage_bar on/off
|
# --memory_bar bar/infobar/barinfo/off
|
||||||
# --memory_bar on/off
|
# --battery_bar bar/infobar/barinfo/off
|
||||||
# --battery_bar on/off
|
# --disk_bar bar/infobar/barinfo/off
|
||||||
# --disk_bar on/off
|
memory_display="off"
|
||||||
cpu_usage_bar="off"
|
battery_display="off"
|
||||||
memory_bar="off"
|
disk_display="off"
|
||||||
battery_bar="off"
|
|
||||||
disk_bar="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"
|
|
||||||
|
|
||||||
# }}}
|
# }}}
|
||||||
|
|
||||||
|
@ -881,6 +875,44 @@ getcpu () {
|
||||||
cpu=${cpu// Six-Core}
|
cpu=${cpu// Six-Core}
|
||||||
cpu=${cpu// Eight-Core}
|
cpu=${cpu// Eight-Core}
|
||||||
cpu=${cpu// with Radeon HD Graphics}
|
cpu=${cpu// with Radeon HD Graphics}
|
||||||
|
|
||||||
|
# Make the output of cpu shorter
|
||||||
|
case "$cpu_shorthand" in
|
||||||
|
"name")
|
||||||
|
cpu=${cpu/@*}
|
||||||
|
;;
|
||||||
|
|
||||||
|
"speed")
|
||||||
|
cpu=${cpu#*@ }
|
||||||
|
;;
|
||||||
|
|
||||||
|
"on" | "tiny")
|
||||||
|
cpu=${cpu/Intel }
|
||||||
|
cpu=${cpu/Core }
|
||||||
|
cpu=${cpu/Core? Duo }
|
||||||
|
cpu=${cpu/AMD }
|
||||||
|
|
||||||
|
case "$cpu_shorthand" in
|
||||||
|
"tiny") cpu=${cpu/@*} ;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
|
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}" ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
unset cpu
|
||||||
}
|
}
|
||||||
|
|
||||||
# }}}
|
# }}}
|
||||||
|
@ -1090,12 +1122,11 @@ getmemory () {
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# Progress bars
|
# Progress bars
|
||||||
if [ "$memory_bar" == "on" ]; then
|
case "$memory_display" in
|
||||||
case "$memory_info" in
|
"bar") memory="$(bar "${memused}" "${memtotal}")" ;;
|
||||||
"off") memory=" $(bar "$memused" "$memtotal")" ;;
|
"infobar") memory="${memory} $(bar "${memused}" "${memtotal}")" ;;
|
||||||
*) memory+=" $(bar "$memused" "$memtotal")" ;;
|
"barinfo") memory="$(bar "${memused}" "${memtotal}") ${memory}" ;;
|
||||||
esac
|
esac
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# }}}
|
# }}}
|
||||||
|
@ -1398,17 +1429,17 @@ getdisk () {
|
||||||
# Put it all together
|
# Put it all together
|
||||||
disk="${disk_used} / ${disk_total} (${disk_total_per})"
|
disk="${disk_used} / ${disk_total} (${disk_total_per})"
|
||||||
|
|
||||||
if [ "$disk_bar" == "on" ]; then
|
# Add info bar
|
||||||
disk_used=${disk_used/G}
|
disk_used=${disk_used/G}
|
||||||
disk_used=${disk_used/T}
|
disk_used=${disk_used/T}
|
||||||
disk_total=${disk_total/G}
|
disk_total=${disk_total/G}
|
||||||
disk_total=${disk_total/T}
|
disk_total=${disk_total/T}
|
||||||
|
|
||||||
case "$disk_info" in
|
case "$disk_display" in
|
||||||
"off") disk="$(bar "${disk_used/'.'}" "${disk_total/'.'}")" ;;
|
"bar") disk="$(bar "${disk_used/'.'}" "${disk_total/'.'}")" ;;
|
||||||
*) disk+=" $(bar "${disk_used/'.'}" "${disk_total/'.'}")" ;;
|
"infobar") disk+=" $(bar "${disk_used/'.'}" "${disk_total/'.'}")" ;;
|
||||||
esac
|
"barinfo") disk="$(bar "${disk_used/'.'}" "${disk_total/'.'}") $disk" ;;
|
||||||
fi
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
# }}}
|
# }}}
|
||||||
|
@ -1496,12 +1527,11 @@ getbattery () {
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
if [ "$battery_bar" == "on" ]; then
|
case "$battery_display" in
|
||||||
case "$battery_info" in
|
"bar") battery="$(bar ${battery/'%'} 100)" ;;
|
||||||
"off") battery="$(bar ${battery/'%'} 100)" ;;
|
"infobar") battery="${battery} $(bar "${battery/'%'}" 100)" ;;
|
||||||
*) battery+=" $(bar ${battery/'%'} 100)" ;;
|
"barinfo") battery="$(bar "${battery/'%'}" 100) ${battery}" ;;
|
||||||
esac
|
esac
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# }}}
|
# }}}
|
||||||
|
@ -2395,10 +2425,15 @@ usage () { cat << EOF
|
||||||
--progress_length num Length in spaces to make the progress bars.
|
--progress_length num Length in spaces to make the progress bars.
|
||||||
--progress_colors num num Colors to make the progress bar. Set in this order:
|
--progress_colors num num Colors to make the progress bar. Set in this order:
|
||||||
elapsed, total
|
elapsed, total
|
||||||
--cpu_usage_bar on/off Whether or not to print a progress bar for cpu usage.
|
--cpu_display mode1 mode2 Which shorthand to use and how CPU usage should be printed
|
||||||
--memory_bar on/off Whether or not to print a progress bar for memory usage.
|
mode1 takes: name, speed, tiny, on, off
|
||||||
--battery_bar on/off Whether or not to print a progress bar for battery usage.
|
mode2 takes: info, bar, infobar, barinfo
|
||||||
--disk_bar on/off Whether or not to print a progress bar for disk usage.
|
--memory_display mode Which way should the memory progress bar be added
|
||||||
|
Takes bar, infobar, barinfo
|
||||||
|
--battery_display mode Which way should the battery progress bar be added
|
||||||
|
Takes bar, infobar, barinfo
|
||||||
|
--disk_display mode Which way should the disk progress bar be added
|
||||||
|
Takes bar, infobar, barinfo
|
||||||
|
|
||||||
|
|
||||||
Image:
|
Image:
|
||||||
|
@ -2521,14 +2556,13 @@ while [ "$1" ]; do
|
||||||
progress_color_elapsed="$2"
|
progress_color_elapsed="$2"
|
||||||
progress_color_total="$3"
|
progress_color_total="$3"
|
||||||
;;
|
;;
|
||||||
--cpu_usage_bar) cpu_usage_bar="$2" ;;
|
--cpu_display)
|
||||||
--memory_bar) memory_bar="$2" ;;
|
cpu_shorthand="$2"
|
||||||
--battery_bar) battery_bar="$2" ;;
|
cpu_display="$3"
|
||||||
--disk_bar) disk_bar="$2" ;;
|
;;
|
||||||
--cpu_usage_info) cpu_usage_info="$2" ;;
|
--memory_display) memory_display="$2" ;;
|
||||||
--memory_info) memory_info="$2" ;;
|
--battery_display) battery_display="$2" ;;
|
||||||
--battery_info) battery_info="$2" ;;
|
--disk_display) disk_display="$2" ;;
|
||||||
--disk_info) disk_info="$2" ;;
|
|
||||||
|
|
||||||
# Image
|
# Image
|
||||||
--image)
|
--image)
|
||||||
|
|
Loading…
Reference in a new issue