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

This commit is contained in:
Dylan Araps 2018-06-09 17:23:07 +10:00
commit 329abc5c46

View file

@ -774,7 +774,7 @@ get_os() {
# $kernel_name is set in a function called cache_uname and is # $kernel_name is set in a function called cache_uname and is
# just the output of "uname -s". # just the output of "uname -s".
case "$kernel_name" in case "$kernel_name" in
"Darwin"): "$(sw_vers -productName)" ;; "Darwin"): "$darwin_name" ;;
"SunOS"): "Solaris" ;; "SunOS"): "Solaris" ;;
"Haiku"): "Haiku" ;; "Haiku"): "Haiku" ;;
"MINIX"): "MINIX" ;; "MINIX"): "MINIX" ;;
@ -926,9 +926,6 @@ get_distro() {
;; ;;
"Mac OS X") "Mac OS X")
osx_version="$(sw_vers -productVersion)"
osx_build="$(sw_vers -buildVersion)"
case "$osx_version" in case "$osx_version" in
"10.4"*) codename="Mac OS X Tiger" ;; "10.4"*) codename="Mac OS X Tiger" ;;
"10.5"*) codename="Mac OS X Leopard" ;; "10.5"*) codename="Mac OS X Leopard" ;;
@ -959,7 +956,7 @@ get_distro() {
;; ;;
"iPhone OS") "iPhone OS")
distro="iOS $(sw_vers -productVersion)" distro="iOS $osx_version"
# "uname -m" doesn't print architecture on iOS so we force it off. # "uname -m" doesn't print architecture on iOS so we force it off.
os_arch="off" os_arch="off"
@ -1780,7 +1777,7 @@ get_cpu() {
# Get CPU cores. # Get CPU cores.
case "$cpu_cores" in case "$cpu_cores" in
"logical" | "on") cores="$(grep -c "^processor" "$cpu_file")" ;; "logical" | "on") cores="$(grep -c "^processor" "$cpu_file")" ;;
"physical") cores="$(awk '/^core id/&&!a[$0]++{++i}END{print i}' "$cpu_file")" ;; "physical") cores="$(awk '/^core id/&&!a[$0]++{++i} END {print i}' "$cpu_file")" ;;
esac esac
;; ;;
@ -2027,7 +2024,7 @@ get_gpu() {
"Linux") "Linux")
# Read GPUs into array. # Read GPUs into array.
gpu_cmd="$(lspci -mm | awk -F '\\"|\\" \\"|\\(' \ gpu_cmd="$(lspci -mm | awk -F '\\"|\\" \\"|\\(' \
'/"Display|"3D|"VGA/ {a[$0] = $3 " " $4} END{for(i in a) '/"Display|"3D|"VGA/ {a[$0] = $3 " " $4} END {for(i in a)
{if(!seen[a[i]]++) print a[i]}}')" {if(!seen[a[i]]++) print a[i]}}')"
IFS=$'\n' read -d "" -ra gpus <<< "$gpu_cmd" IFS=$'\n' read -d "" -ra gpus <<< "$gpu_cmd"
@ -2232,13 +2229,13 @@ get_memory() {
;; ;;
"OpenBSD"*) ;; "OpenBSD"*) ;;
*) mem_free="$(($(vmstat | awk 'END{printf $5}') / 1024))" ;; *) mem_free="$(($(vmstat | awk 'END {printf $5}') / 1024))" ;;
esac esac
# Mem used. # Mem used.
case "$kernel_name" in case "$kernel_name" in
"OpenBSD"*) "OpenBSD"*)
mem_used="$(vmstat | awk 'END{printf $3}')" mem_used="$(vmstat | awk 'END {printf $3}')"
mem_used="${mem_used/M}" mem_used="${mem_used/M}"
;; ;;
@ -2372,6 +2369,8 @@ get_song() {
"audacious"*) get_song_dbus "audacious" ;; "audacious"*) get_song_dbus "audacious" ;;
"vlc"*) get_song_dbus "vlc" ;; "vlc"*) get_song_dbus "vlc" ;;
"gmusicbrowser"*) get_song_dbus "gmusicbrowser" ;; "gmusicbrowser"*) get_song_dbus "gmusicbrowser" ;;
"pragha"*) get_song_dbus "pragha" ;;
"amarok"*) get_song_dbus "amarok" ;;
"cmus"*) "cmus"*)
song="$(cmus-remote -Q | awk 'BEGIN { ORS=" "}; song="$(cmus-remote -Q | awk 'BEGIN { ORS=" "};
@ -2408,21 +2407,11 @@ get_song() {
"banshee"*) "banshee"*)
song="$(banshee --query-artist --query-album --query-title |\ song="$(banshee --query-artist --query-album --query-title |\
awk -F':' '/^artist/ {a=$2} /^album/ {b=$2} /^title/ {t=$2} awk -F':' '/^artist/ {a=$2} /^album/ {b=$2} /^title/ {t=$2}
END{print a " \n " b " \n "t}')" END {print a " \n " b " \n "t}')"
;;
"amarok"*)
song="$(qdbus org.kde.amarok /Player GetMetadata |\
awk -F':' '/^artist:/ {a=$2} /^album:/ {b=$2} /^title:/ {t=$2}
END{print a " \n " b " \n " t}')"
;;
"pragha"*)
song="$(pragha -c | awk -F':' '/^artist/ {a=$2} /^album/ {b=$2} /^title/ {t=$2}
END{print a " \n " b " \n " t}')"
;; ;;
"exaile"*) "exaile"*)
# NOTE: Exaile >= 4.0.0 will support mpris2.
song="$(dbus-send --print-reply --dest=org.exaile.Exaile /org/exaile/Exaile \ song="$(dbus-send --print-reply --dest=org.exaile.Exaile /org/exaile/Exaile \
org.exaile.Exaile.Query | org.exaile.Exaile.Query |
awk -F':|,' '{if ($6 && $8 && $4) printf $6 " \n" $8 " \n" $4}')" awk -F':|,' '{if ($6 && $8 && $4) printf $6 " \n" $8 " \n" $4}')"
@ -2432,7 +2421,7 @@ get_song() {
song="$(dbus-send --print-reply --dest=net.sacredchao.QuodLibet \ song="$(dbus-send --print-reply --dest=net.sacredchao.QuodLibet \
/net/sacredchao/QuodLibet net.sacredchao.QuodLibet.CurrentSong |\ /net/sacredchao/QuodLibet net.sacredchao.QuodLibet.CurrentSong |\
awk -F'"' '/artist/ {getline; a=$2} /album/ {getline; b=$2} awk -F'"' '/artist/ {getline; a=$2} /album/ {getline; b=$2}
/title/ {getline; t=$2} END{print a " \n " b " \n " t}')" /title/ {getline; t=$2} END {print a " \n " b " \n " t}')"
;; ;;
"pogo"*) "pogo"*)
@ -2840,13 +2829,13 @@ END
;; ;;
"deepin-terminal"*) "deepin-terminal"*)
term_font="$(awk -F '=' '/font=/ {a=$2} /font_size/ {b=$2} END{print a " " b}' \ term_font="$(awk -F '=' '/font=/ {a=$2} /font_size/ {b=$2} END {print a " " b}' \
"${XDG_CONFIG_HOME}/deepin/deepin-terminal/config.conf")" "${XDG_CONFIG_HOME}/deepin/deepin-terminal/config.conf")"
;; ;;
"GNUstep_Terminal") "GNUstep_Terminal")
term_font="$(awk -F '>|<' '/>TerminalFont</ {getline; f=$3} term_font="$(awk -F '>|<' '/>TerminalFont</ {getline; f=$3}
/>TerminalFontSize</ {getline; s=$3} END{print f " " s}' \ />TerminalFontSize</ {getline; s=$3} END {print f " " s}' \
"${HOME}/GNUstep/Defaults/Terminal.plist")" "${HOME}/GNUstep/Defaults/Terminal.plist")"
;; ;;
@ -2956,7 +2945,7 @@ END
;; ;;
"qterminal") "qterminal")
term_font="$(awk -F '=' '/fontFamily=/ {a=$2} /fontSize=/ {b=$2} END{print a " " b}' \ term_font="$(awk -F '=' '/fontFamily=/ {a=$2} /fontSize=/ {b=$2} END {print a " " b}' \
"${XDG_CONFIG_HOME}/qterminal.org/qterminal.ini")" "${XDG_CONFIG_HOME}/qterminal.org/qterminal.ini")"
;; ;;
@ -3048,7 +3037,7 @@ END
;; ;;
"xfce4-terminal") "xfce4-terminal")
term_font="$(awk -F '=' '/^FontName/{a=$2}/^FontUseSystem=TRUE/{a=$0}END{print a}' \ term_font="$(awk -F '=' '/^FontName/{a=$2}/^FontUseSystem=TRUE/{a=$0} END {print a}' \
"${XDG_CONFIG_HOME}/xfce4/terminal/terminalrc")" "${XDG_CONFIG_HOME}/xfce4/terminal/terminalrc")"
[[ "$term_font" == "FontUseSystem=TRUE" ]] && \ [[ "$term_font" == "FontUseSystem=TRUE" ]] && \
@ -4161,6 +4150,14 @@ cache_uname() {
kernel_name="${uname[0]}" kernel_name="${uname[0]}"
kernel_version="${uname[1]}" kernel_version="${uname[1]}"
kernel_machine="${uname[2]}" kernel_machine="${uname[2]}"
if [[ "$kernel_name" == "Darwin" ]]; then
IFS=$'\n' read -d "" -ra sw_vers < <(awk -F'<|>' '/string/ {print $3}' \
"/System/Library/CoreServices/SystemVersion.plist")
darwin_name="${sw_vers[2]}"
osx_version="${sw_vers[3]}"
osx_build="${sw_vers[0]}"
fi
} }
get_ppid() { get_ppid() {