Merge pull request #187 from dylanaraps/cpu_whitespace
Fix huge whitespace in CPU output
This commit is contained in:
commit
9161b8a1a1
1 changed files with 17 additions and 16 deletions
33
neofetch
33
neofetch
|
@ -430,8 +430,9 @@ config_file="$HOME/.config/neofetch/config"
|
||||||
# Gather Info {{{
|
# Gather Info {{{
|
||||||
|
|
||||||
|
|
||||||
# Set no case match
|
# Set no case match and extended globbing.
|
||||||
shopt -s nocasematch
|
shopt -s nocasematch
|
||||||
|
shopt -s extglob
|
||||||
|
|
||||||
|
|
||||||
# Operating System {{{
|
# Operating System {{{
|
||||||
|
@ -512,6 +513,7 @@ case "$os" in
|
||||||
x32="32-bit"
|
x32="32-bit"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
distro=${distro//+( )/ }
|
||||||
ascii_distro="$distro"
|
ascii_distro="$distro"
|
||||||
|
|
||||||
getdistro () {
|
getdistro () {
|
||||||
|
@ -554,12 +556,10 @@ getuptime () {
|
||||||
case "$distro" in
|
case "$distro" in
|
||||||
*"Puppy"* | "Quirky Werewolf"* | "Alpine Linux"* | "Windows"*)
|
*"Puppy"* | "Quirky Werewolf"* | "Alpine Linux"* | "Windows"*)
|
||||||
uptime=$(uptime | awk -F ':[0-9]{2}+ |(, ){1}+' '{printf $2}')
|
uptime=$(uptime | awk -F ':[0-9]{2}+ |(, ){1}+' '{printf $2}')
|
||||||
uptime=${uptime/ / }
|
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"openSUSE"*)
|
"openSUSE"*)
|
||||||
uptime=$(uptime | awk -F ':[0-9]{2}+[a-z][a-z] |(, ){1}+' '{printf $2}')
|
uptime=$(uptime | awk -F ':[0-9]{2}+[a-z][a-z] |(, ){1}+' '{printf $2}')
|
||||||
uptime=${uptime/ / }
|
|
||||||
;;
|
;;
|
||||||
|
|
||||||
*)
|
*)
|
||||||
|
@ -630,6 +630,7 @@ getuptime () {
|
||||||
uptime=${uptime# }
|
uptime=${uptime# }
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
uptime=${uptime//+( )/ }
|
||||||
}
|
}
|
||||||
|
|
||||||
# }}}
|
# }}}
|
||||||
|
@ -839,7 +840,6 @@ getcpu () {
|
||||||
|
|
||||||
"Mac OS X")
|
"Mac OS X")
|
||||||
cpu="$(sysctl -n machdep.cpu.brand_string)"
|
cpu="$(sysctl -n machdep.cpu.brand_string)"
|
||||||
cpu=${cpu/ }
|
|
||||||
cores=$(sysctl -n hw.ncpu)
|
cores=$(sysctl -n hw.ncpu)
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
@ -850,8 +850,6 @@ getcpu () {
|
||||||
cpu="$(sysctl -n hw.model)"
|
cpu="$(sysctl -n hw.model)"
|
||||||
cpu=${cpu/[0-9]\.*}
|
cpu=${cpu/[0-9]\.*}
|
||||||
cpu=${cpu/ @*}
|
cpu=${cpu/ @*}
|
||||||
cpu=${cpu// }
|
|
||||||
cpu=${cpu% }
|
|
||||||
|
|
||||||
# Get cpu speed
|
# Get cpu speed
|
||||||
case "$distro" in
|
case "$distro" in
|
||||||
|
@ -894,11 +892,11 @@ getcpu () {
|
||||||
cpu=${cpu//(TM)}
|
cpu=${cpu//(TM)}
|
||||||
cpu=${cpu//(r)}
|
cpu=${cpu//(r)}
|
||||||
cpu=${cpu//(R)}
|
cpu=${cpu//(R)}
|
||||||
cpu=${cpu// CPU}
|
cpu=${cpu//CPU}
|
||||||
cpu=${cpu// Processor}
|
cpu=${cpu//Processor}
|
||||||
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}
|
||||||
|
|
||||||
# Add cpu cores to output
|
# Add cpu cores to output
|
||||||
[ "$cpu_cores" == "on" ] && [ ! -z "$cores" ] && \
|
[ "$cpu_cores" == "on" ] && [ ! -z "$cores" ] && \
|
||||||
|
@ -926,6 +924,9 @@ getcpu () {
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
# Trim whitespace
|
||||||
|
cpu=${cpu//+( )/ }
|
||||||
|
|
||||||
# Add CPU info bar
|
# Add CPU info bar
|
||||||
prin "${subtitle}: ${cpu}"
|
prin "${subtitle}: ${cpu}"
|
||||||
|
|
||||||
|
@ -1011,7 +1012,6 @@ getgpu () {
|
||||||
|
|
||||||
nvidia*)
|
nvidia*)
|
||||||
gpu=${gpu/NVIDIA Corporation }
|
gpu=${gpu/NVIDIA Corporation }
|
||||||
gpu=${gpu/nVidia Corporation }
|
|
||||||
gpu=${gpu/G????M }
|
gpu=${gpu/G????M }
|
||||||
gpu=${gpu/G???? }
|
gpu=${gpu/G???? }
|
||||||
gpu=${gpu/\[}
|
gpu=${gpu/\[}
|
||||||
|
@ -1040,8 +1040,6 @@ getgpu () {
|
||||||
gpu=$(pciconf -lv 2>/dev/null | grep -B 4 "VGA" | grep "device")
|
gpu=$(pciconf -lv 2>/dev/null | grep -B 4 "VGA" | grep "device")
|
||||||
gpu=${gpu/device*= }
|
gpu=${gpu/device*= }
|
||||||
gpu=${gpu//\'}
|
gpu=${gpu//\'}
|
||||||
gpu=${gpu//[[:space:]]/ }
|
|
||||||
gpu=${gpu// }
|
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
;;
|
;;
|
||||||
|
@ -1077,6 +1075,7 @@ getgpu () {
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
gpu=${gpu//+( )/ }
|
||||||
gpu="${gpu}${count}"
|
gpu="${gpu}${count}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1487,6 +1486,7 @@ getdisk () {
|
||||||
*"BSD")
|
*"BSD")
|
||||||
case "$distro" in
|
case "$distro" in
|
||||||
"FreeBSD"*) df_flags="-h -c -l" ;;
|
"FreeBSD"*) df_flags="-h -c -l" ;;
|
||||||
|
*) return ;;
|
||||||
esac
|
esac
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
@ -1590,7 +1590,8 @@ getbattery () {
|
||||||
battery0now=$(sysctl -n hw.sensors.acpibat0.watthour3)
|
battery0now=$(sysctl -n hw.sensors.acpibat0.watthour3)
|
||||||
battery0now="${battery0now/ Wh*}"
|
battery0now="${battery0now/ Wh*}"
|
||||||
|
|
||||||
battery="$(printf "%s\n" "100 * $battery0now / $battery0full" | bc)%"
|
[ ! -z "$battery0full" ] && \
|
||||||
|
battery="$(printf "%s\n" "100 * $battery0now / $battery0full" | bc)%"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"Mac OS X")
|
"Mac OS X")
|
||||||
|
@ -1726,7 +1727,7 @@ getbirthday () {
|
||||||
|
|
||||||
# Pretty output
|
# Pretty output
|
||||||
[ "$birthday_shorthand" == "off" ] && \
|
[ "$birthday_shorthand" == "off" ] && \
|
||||||
birthday="${date_cmd/ / }"
|
birthday=${date_cmd//+( )/ }
|
||||||
|
|
||||||
# Toggle showing the time
|
# Toggle showing the time
|
||||||
[ "$birthday_time" == "off" ] && \
|
[ "$birthday_time" == "off" ] && \
|
||||||
|
|
Loading…
Reference in a new issue