From 2e1c942491ad8d34d64ee0b0d0677c95b4f076a0 Mon Sep 17 00:00:00 2001 From: Muhammad Herdiansyah Date: Fri, 14 Jul 2017 02:25:17 +0700 Subject: [PATCH] CPU [Speed]: Use the cpu_cores approach instead of deleting it manually. This way, we don't have to replace the "@" with "($cores) @" and remove the CPU speed from the output. --- neofetch | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/neofetch b/neofetch index aff94700..7d8c0240 100755 --- a/neofetch +++ b/neofetch @@ -1013,16 +1013,6 @@ get_cpu() { ;; esac - if [[ "$speed" ]]; then - if (( speed < 1000 )); then - cpu="$cpu @ ${speed}MHz $temp" - else - [[ "$speed_shorthand" == "on" ]] && speed="$((speed / 100))" - speed="${speed:0:1}.${speed:1}" - cpu="$cpu @ ${speed}GHz $temp" - fi - fi - # Remove un-needed patterns from cpu output. cpu="${cpu//(TM)}" cpu="${cpu//(tm)}" @@ -1047,11 +1037,18 @@ get_cpu() { # Add CPU cores to the output. [[ "$cpu_cores" != "off" && "$cores" ]] && \ - cpu="${cpu/@/(${cores}) @}" + cpu="$cpu ($cores)" - # Remove CPU speed from the output. - [[ "$cpu_speed" == "off" ]] && \ - cpu="${cpu/@ *GHz}" + # Add CPU speed to the output. + if [[ "$cpu_speed" != "off" && "$speed" ]]; then + if (( speed < 1000 )); then + cpu="$cpu @ ${speed}MHz $temp" + else + [[ "$speed_shorthand" == "on" ]] && speed="$((speed / 100))" + speed="${speed:0:1}.${speed:1}" + cpu="$cpu @ ${speed}GHz $temp" + fi + fi # Make the output of CPU shorter. case "$cpu_shorthand" in