Merge branch 'master' of github.com:dylanaraps/neofetch

This commit is contained in:
Dylan 2016-04-05 00:53:19 +10:00
commit a02f8577e3
1 changed files with 33 additions and 61 deletions

View File

@ -452,10 +452,6 @@ esac
# Distro {{{ # Distro {{{
# Default bit style
x64="x86_64"
x32="x86"
case "$os" in case "$os" in
"Linux" ) "Linux" )
if type -p lsb_release >/dev/null 2>&1; then if type -p lsb_release >/dev/null 2>&1; then
@ -510,10 +506,6 @@ case "$os" in
distro=${distro//[[:space:]]/ } distro=${distro//[[:space:]]/ }
distro=${distro// } distro=${distro// }
distro=${distro/Microsoft } distro=${distro/Microsoft }
# Change bits to xx-bit for Windows
x64="64-bit"
x32="32-bit"
;; ;;
esac esac
distro=${distro//+( )/ } distro=${distro//+( )/ }
@ -521,12 +513,8 @@ ascii_distro="$distro"
getdistro () { getdistro () {
# Get architecture # Get architecture
if [ "$os_arch" == "on" ]; then [ "$os_arch" == "on" ] && \
case "$(getconf LONG_BIT)" in distro+=" $(uname -m)"
64) distro+=" $x64" ;;
32) distro+=" $x32" ;;
esac
fi
} }
@ -781,8 +769,8 @@ getde () {
;; ;;
esac esac
if [ -z "$de" ]; then if [ -n "$DISPLAY" ] && [ -z "$de" ]; then
de="$(xprop -root | awk '/KDE_SESSION_VERSION|^_MARCO|^_MUFFIN|xfce4|xfce5/')" de="$(xprop -root | awk '/KDE_SESSION_VERSION|^_MARCO|^_MUFFIN|xfce4|xfce5/' 2>/dev/null)"
case "$de" in case "$de" in
"KDE_SESSION_VERSION"*) de="KDE${de/* = }" ;; "KDE_SESSION_VERSION"*) de="KDE${de/* = }" ;;
@ -941,7 +929,29 @@ getwmtheme () {
getcpu () { getcpu () {
case "$os" in case "$os" in
"Linux") "Mac OS X")
cpu="$(sysctl -n machdep.cpu.brand_string)"
cores=$(sysctl -n hw.ncpu)
;;
*)
case "$distro" in
"OpenBSD"* | "FreeBSD"*)
# Get cpu name
cpu="$(sysctl -n hw.model)"
cpu=${cpu/[0-9]\.*}
cpu=${cpu/ @*}
# Get cpu speed
case "$distro" in
"OpenBSD"*) speed=$(sysctl -n hw.cpuspeed) ;;
"FreeBSD"*) speed=$(sysctl -n hw.clockrate) ;;
esac
speed=$((speed / 100))
cores=$(sysctl -n hw.ncpu)
;;
*)
# Get cpu name # Get cpu name
cpu="$(awk -F ': | @' '/model name/ {printf $2; exit}' /proc/cpuinfo)" cpu="$(awk -F ': | @' '/model name/ {printf $2; exit}' /proc/cpuinfo)"
@ -965,56 +975,18 @@ getcpu () {
speed=$(awk -F ': |\\.' '/cpu MHz/ {printf $2; exit}' /proc/cpuinfo) speed=$(awk -F ': |\\.' '/cpu MHz/ {printf $2; exit}' /proc/cpuinfo)
speed=$((speed / 100)) speed=$((speed / 100))
fi fi
speed=${speed:0:1}.${speed:1}
cpu="$cpu @ ${speed}GHz"
cores=$(awk -F ': ' '/siblings/ {printf $2; exit}' /proc/cpuinfo)
;;
"Mac OS X")
cpu="$(sysctl -n machdep.cpu.brand_string)"
cores=$(sysctl -n hw.ncpu)
;;
*"BSD" | "Windows")
case "$distro" in
"OpenBSD"* | "FreeBSD"*)
# Get cpu name
cpu="$(sysctl -n hw.model)"
cpu=${cpu/[0-9]\.*}
cpu=${cpu/ @*}
# Get cpu speed
case "$distro" in
"OpenBSD"*) speed=$(sysctl -n hw.cpuspeed) ;;
"FreeBSD"*) speed=$(sysctl -n hw.clockrate) ;;
esac
speed=$((speed / 100))
cores=$(sysctl -n hw.ncpu)
;;
"NetBSD"* | "Windows"*)
# Get cpu name
cpu="$(grep -F 'model name' /proc/cpuinfo)"
cpu=${cpu/model name*: }
cpu=${cpu/ @*}
cpu=${cpu// }
cpu=${cpu% }
# Get cpu speed
speed="$(grep -F 'cpu MHz' /proc/cpuinfo)"
speed=${speed/cpu MHz*: }
speed=${speed/\.}
case "$distro" in
"NetBSD"*) speed=$((speed / 10000)) ;;
"Windows"*) speed=$((speed / 100000)) ;;
esac
cores=$(awk -F ': ' '/siblings/ {printf $2; exit}' /proc/cpuinfo) cores=$(awk -F ': ' '/siblings/ {printf $2; exit}' /proc/cpuinfo)
;; ;;
esac esac
# Fix for speeds under 1ghz
if [ -z "${speed:1}" ]; then
speed="0.${speed}"
else
speed=${speed:0:1}.${speed:1} speed=${speed:0:1}.${speed:1}
fi
cpu="$cpu @ ${speed}GHz" cpu="$cpu @ ${speed}GHz"
;; ;;
esac esac