diff --git a/scripts/cpu.sh b/scripts/cpu.sh index adc2223..b604156 100755 --- a/scripts/cpu.sh +++ b/scripts/cpu.sh @@ -36,7 +36,7 @@ print_cpu_usage() { local cpu_color=$(get_cpu_color "$cpu_pused") local cpu_view="$cpu_view_tmpl" - cpu_view="${cpu_view//'#{cpu.pused}'/$(printf "%.1f%%" "$cpu_pused")}" + cpu_view="${cpu_view//'#{cpu.pused}'/$(printf "%2.0f%%" "$cpu_pused")}" cpu_view="${cpu_view//'#{cpu.color}'/$(echo "$cpu_color" | awk '{ print $1 }')}" cpu_view="${cpu_view//'#{cpu.color2}'/$(echo "$cpu_color" | awk '{ print $2 }')}" cpu_view="${cpu_view//'#{cpu.color3}'/$(echo "$cpu_color" | awk '{ print $3 }')}" diff --git a/scripts/cpu_collect.sh b/scripts/cpu_collect.sh index 768caba..a37148f 100755 --- a/scripts/cpu_collect.sh +++ b/scripts/cpu_collect.sh @@ -22,7 +22,7 @@ get_cpu_usage() { | sed -u -nr '/CPU usage/s/.*,[[:space:]]*([0-9]+[.,][0-9]*)%[[:space:]]*idle.*/\1/p' \ | stdbuf -o0 awk '{ print 100-$0 }' fi - elif ! command_exists "vmstat"; then + elif command_exists "vmstat"; then if is_freebsd; then vmstat -n "$refresh_interval" -c "$samples_count" \ | stdbuf -o0 awk 'NR>2 {print 100-$(NF-0)}' diff --git a/scripts/mem.sh b/scripts/mem.sh index 6a032bf..93e6311 100755 --- a/scripts/mem.sh +++ b/scripts/mem.sh @@ -59,9 +59,9 @@ print_mem() { local mem_view="$mem_view_tmpl" mem_view="${mem_view//'#{mem.used}'/$(printf "$size_format" "$mem_used" "$size_unit")}" - mem_view="${mem_view//'#{mem.pused}'/$(printf "%.0f%%" "$mem_pused")}" + mem_view="${mem_view//'#{mem.pused}'/$(printf "%2.0f%%" "$mem_pused")}" mem_view="${mem_view//'#{mem.free}'/$(printf "$size_format" "$mem_free" "$size_unit")}" - mem_view="${mem_view//'#{mem.pfree}'/$(printf "%.0f%%" "$mem_pfree")}" + mem_view="${mem_view//'#{mem.pfree}'/$(printf "%2.0f%%" "$mem_pfree")}" mem_view="${mem_view//'#{mem.total}'/$(printf "$size_format" "$mem_total" "$size_unit")}" mem_view="${mem_view//'#{mem.color}'/$(echo "$mem_color" | awk '{ print $1 }')}" mem_view="${mem_view//'#{mem.color2}'/$(echo "$mem_color" | awk '{ print $2 }')}"