Add latest macOS support and fix issue (#1487)
Support for both "Mac OS X" and "macOS" Support for macOS 10.16(11.0), Big Sur Resolve issue #1486
This commit is contained in:
parent
af2c02ceb6
commit
f954cbab30
1 changed files with 32 additions and 30 deletions
46
neofetch
46
neofetch
|
@ -1089,7 +1089,7 @@ get_distro() {
|
||||||
distro=${distro/NAME=}
|
distro=${distro/NAME=}
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"Mac OS X")
|
"Mac OS X"|"macOS")
|
||||||
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" ;;
|
||||||
|
@ -1103,6 +1103,8 @@ get_distro() {
|
||||||
10.13*) codename="macOS High Sierra" ;;
|
10.13*) codename="macOS High Sierra" ;;
|
||||||
10.14*) codename="macOS Mojave" ;;
|
10.14*) codename="macOS Mojave" ;;
|
||||||
10.15*) codename="macOS Catalina" ;;
|
10.15*) codename="macOS Catalina" ;;
|
||||||
|
10.16*) codename="macOS Big Sur" ;;
|
||||||
|
11.0*) codename="macOS Big Sur" ;;
|
||||||
*) codename=macOS ;;
|
*) codename=macOS ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
@ -1115,7 +1117,7 @@ get_distro() {
|
||||||
case $osx_version in
|
case $osx_version in
|
||||||
10.[4-7]*) distro=${distro/${codename}/Mac OS X} ;;
|
10.[4-7]*) distro=${distro/${codename}/Mac OS X} ;;
|
||||||
10.[8-9]*|10.1[0-1]*) distro=${distro/${codename}/OS X} ;;
|
10.[8-9]*|10.1[0-1]*) distro=${distro/${codename}/OS X} ;;
|
||||||
10.1[2-4]*) distro=${distro/${codename}/macOS} ;;
|
10.1[2-6]*|11.0*) distro=${distro/${codename}/macOS} ;;
|
||||||
esac
|
esac
|
||||||
distro=${distro/ ${osx_build}}
|
distro=${distro/ ${osx_build}}
|
||||||
;;
|
;;
|
||||||
|
@ -1199,7 +1201,7 @@ get_model() {
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"Mac OS X")
|
"Mac OS X"|"macOS")
|
||||||
if [[ $(kextstat | grep -F -e "FakeSMC" -e "VirtualSMC") != "" ]]; then
|
if [[ $(kextstat | grep -F -e "FakeSMC" -e "VirtualSMC") != "" ]]; then
|
||||||
model="Hackintosh (SMBIOS: $(sysctl -n hw.model))"
|
model="Hackintosh (SMBIOS: $(sysctl -n hw.model))"
|
||||||
else
|
else
|
||||||
|
@ -1371,7 +1373,7 @@ get_uptime() {
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"Mac OS X"|"iPhone OS"|BSD|FreeMiNT)
|
"Mac OS X"|"macOS"|"iPhone OS"|BSD|FreeMiNT)
|
||||||
boot=$(sysctl -n kern.boottime)
|
boot=$(sysctl -n kern.boottime)
|
||||||
boot=${boot/\{ sec = }
|
boot=${boot/\{ sec = }
|
||||||
boot=${boot/,*}
|
boot=${boot/,*}
|
||||||
|
@ -1540,7 +1542,7 @@ get_packages() {
|
||||||
manager=appimage && has appimaged && dir ~/.local/bin/*.appimage
|
manager=appimage && has appimaged && dir ~/.local/bin/*.appimage
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"Mac OS X"|MINIX)
|
"Mac OS X"|"macOS"|MINIX)
|
||||||
has port && tot port installed && ((packages-=1))
|
has port && tot port installed && ((packages-=1))
|
||||||
has brew && dir /usr/local/Cellar/*
|
has brew && dir /usr/local/Cellar/*
|
||||||
has pkgin && tot pkgin list
|
has pkgin && tot pkgin list
|
||||||
|
@ -1656,7 +1658,7 @@ get_de() {
|
||||||
((de_run == 1)) && return
|
((de_run == 1)) && return
|
||||||
|
|
||||||
case $os in
|
case $os in
|
||||||
"Mac OS X") de=Aqua ;;
|
"Mac OS X"|"macOS") de=Aqua ;;
|
||||||
|
|
||||||
Windows)
|
Windows)
|
||||||
case $distro in
|
case $distro in
|
||||||
|
@ -1796,7 +1798,7 @@ get_wm() {
|
||||||
-e westford \
|
-e westford \
|
||||||
-e weston)
|
-e weston)
|
||||||
|
|
||||||
elif [[ $DISPLAY && $os != "Mac OS X" && $os != FreeMiNT ]]; then
|
elif [[ $DISPLAY && $os != "Mac OS X" && $os != "macOS" && $os != FreeMiNT ]]; then
|
||||||
type -p xprop &>/dev/null && {
|
type -p xprop &>/dev/null && {
|
||||||
id=$(xprop -root -notype _NET_SUPPORTING_WM_CHECK)
|
id=$(xprop -root -notype _NET_SUPPORTING_WM_CHECK)
|
||||||
id=${id##* }
|
id=${id##* }
|
||||||
|
@ -1821,7 +1823,7 @@ get_wm() {
|
||||||
|
|
||||||
else
|
else
|
||||||
case $os in
|
case $os in
|
||||||
"Mac OS X")
|
"Mac OS X"|"macOS")
|
||||||
ps_line=$(ps -e | grep -o \
|
ps_line=$(ps -e | grep -o \
|
||||||
-e "[S]pectacle" \
|
-e "[S]pectacle" \
|
||||||
-e "[A]methyst" \
|
-e "[A]methyst" \
|
||||||
|
@ -2101,7 +2103,7 @@ get_cpu() {
|
||||||
esac
|
esac
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"Mac OS X")
|
"Mac OS X"|"macOS")
|
||||||
cpu="$(sysctl -n machdep.cpu.brand_string)"
|
cpu="$(sysctl -n machdep.cpu.brand_string)"
|
||||||
|
|
||||||
# Get CPU cores.
|
# Get CPU cores.
|
||||||
|
@ -2281,7 +2283,7 @@ get_cpu() {
|
||||||
# Add CPU cores to the output.
|
# Add CPU cores to the output.
|
||||||
[[ "$cpu_cores" != "off" && "$cores" ]] && \
|
[[ "$cpu_cores" != "off" && "$cores" ]] && \
|
||||||
case $os in
|
case $os in
|
||||||
"Mac OS X") cpu="${cpu/@/(${cores}) @}" ;;
|
"Mac OS X"|"macOS") cpu="${cpu/@/(${cores}) @}" ;;
|
||||||
*) cpu="$cpu ($cores)" ;;
|
*) cpu="$cpu ($cores)" ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
@ -2322,7 +2324,7 @@ get_cpu_usage() {
|
||||||
if [[ "$cpu_cores" != "logical" ]]; then
|
if [[ "$cpu_cores" != "logical" ]]; then
|
||||||
case $os in
|
case $os in
|
||||||
"Linux" | "MINIX") cores="$(grep -c "^processor" /proc/cpuinfo)" ;;
|
"Linux" | "MINIX") cores="$(grep -c "^processor" /proc/cpuinfo)" ;;
|
||||||
"Mac OS X") cores="$(sysctl -n hw.logicalcpu_max)" ;;
|
"Mac OS X"|"macOS") cores="$(sysctl -n hw.logicalcpu_max)" ;;
|
||||||
"BSD") cores="$(sysctl -n hw.ncpu)" ;;
|
"BSD") cores="$(sysctl -n hw.ncpu)" ;;
|
||||||
"Solaris") cores="$(kstat -m cpu_info | grep -c -F "chip_id")" ;;
|
"Solaris") cores="$(kstat -m cpu_info | grep -c -F "chip_id")" ;;
|
||||||
"Haiku") cores="$(sysinfo -cpu | grep -c -F 'CPU #')" ;;
|
"Haiku") cores="$(sysinfo -cpu | grep -c -F 'CPU #')" ;;
|
||||||
|
@ -2429,7 +2431,7 @@ get_gpu() {
|
||||||
return
|
return
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"Mac OS X")
|
"Mac OS X"|"macOS")
|
||||||
if [[ -f "${cache_dir}/neofetch/gpu" ]]; then
|
if [[ -f "${cache_dir}/neofetch/gpu" ]]; then
|
||||||
source "${cache_dir}/neofetch/gpu"
|
source "${cache_dir}/neofetch/gpu"
|
||||||
|
|
||||||
|
@ -2526,7 +2528,7 @@ get_memory() {
|
||||||
mem_total="$((mem_total / 1024))"
|
mem_total="$((mem_total / 1024))"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"Mac OS X" | "iPhone OS")
|
"Mac OS X" | "macOS" | "iPhone OS")
|
||||||
mem_total="$(($(sysctl -n hw.memsize) / 1024 / 1024))"
|
mem_total="$(($(sysctl -n hw.memsize) / 1024 / 1024))"
|
||||||
mem_wired="$(vm_stat | awk '/ wired/ { print $4 }')"
|
mem_wired="$(vm_stat | awk '/ wired/ { print $4 }')"
|
||||||
mem_active="$(vm_stat | awk '/ active/ { printf $3 }')"
|
mem_active="$(vm_stat | awk '/ active/ { printf $3 }')"
|
||||||
|
@ -2750,7 +2752,7 @@ get_song() {
|
||||||
case $os in
|
case $os in
|
||||||
"Linux") get_song_dbus "spotify" ;;
|
"Linux") get_song_dbus "spotify" ;;
|
||||||
|
|
||||||
"Mac OS X")
|
"Mac OS X"|"macOS")
|
||||||
song="$(osascript -e 'tell application "Spotify" to artist of current track as¬
|
song="$(osascript -e 'tell application "Spotify" to artist of current track as¬
|
||||||
string & "\n" & album of current track as¬
|
string & "\n" & album of current track as¬
|
||||||
string & "\n" & name of current track as string')"
|
string & "\n" & name of current track as string')"
|
||||||
|
@ -2832,7 +2834,7 @@ get_song() {
|
||||||
|
|
||||||
get_resolution() {
|
get_resolution() {
|
||||||
case $os in
|
case $os in
|
||||||
"Mac OS X")
|
"Mac OS X"|"macOS")
|
||||||
if type -p screenresolution >/dev/null; then
|
if type -p screenresolution >/dev/null; then
|
||||||
resolution="$(screenresolution get 2>&1 | awk '/Display/ {printf $6 "Hz, "}')"
|
resolution="$(screenresolution get 2>&1 | awk '/Display/ {printf $6 "Hz, "}')"
|
||||||
resolution="${resolution//x??@/ @ }"
|
resolution="${resolution//x??@/ @ }"
|
||||||
|
@ -2939,7 +2941,7 @@ get_style() {
|
||||||
# Fix weird output when the function is run multiple times.
|
# Fix weird output when the function is run multiple times.
|
||||||
unset gtk2_theme gtk3_theme theme path
|
unset gtk2_theme gtk3_theme theme path
|
||||||
|
|
||||||
if [[ "$DISPLAY" && "$os" != "Mac OS X" ]]; then
|
if [[ "$DISPLAY" && $os != "Mac OS X" && $os != "macOS" ]]; then
|
||||||
# Get DE if user has disabled the function.
|
# Get DE if user has disabled the function.
|
||||||
((de_run != 1)) && get_de
|
((de_run != 1)) && get_de
|
||||||
|
|
||||||
|
@ -3622,7 +3624,7 @@ get_battery() {
|
||||||
esac
|
esac
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"Mac OS X")
|
"Mac OS X"|"macOS")
|
||||||
battery="$(pmset -g batt | grep -o '[0-9]*%')"
|
battery="$(pmset -g batt | grep -o '[0-9]*%')"
|
||||||
state="$(pmset -g batt | awk '/;/ {print $4}')"
|
state="$(pmset -g batt | awk '/;/ {print $4}')"
|
||||||
[[ "$state" == "charging;" ]] && battery_state="charging"
|
[[ "$state" == "charging;" ]] && battery_state="charging"
|
||||||
|
@ -3662,7 +3664,7 @@ get_local_ip() {
|
||||||
local_ip="$(ifconfig | awk '{printf $3; exit}')"
|
local_ip="$(ifconfig | awk '{printf $3; exit}')"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"Mac OS X" | "iPhone OS")
|
"Mac OS X" | "macOS" | "iPhone OS")
|
||||||
local_ip="$(ipconfig getifaddr en0)"
|
local_ip="$(ipconfig getifaddr en0)"
|
||||||
[[ -z "$local_ip" ]] && local_ip="$(ipconfig getifaddr en1)"
|
[[ -z "$local_ip" ]] && local_ip="$(ipconfig getifaddr en1)"
|
||||||
;;
|
;;
|
||||||
|
@ -3722,7 +3724,7 @@ get_gpu_driver() {
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"Mac OS X")
|
"Mac OS X"|"macOS")
|
||||||
if [[ "$(kextstat | grep "GeForceWeb")" != "" ]]; then
|
if [[ "$(kextstat | grep "GeForceWeb")" != "" ]]; then
|
||||||
gpu_driver="NVIDIA Web Driver"
|
gpu_driver="NVIDIA Web Driver"
|
||||||
else
|
else
|
||||||
|
@ -3889,7 +3891,7 @@ get_image_source() {
|
||||||
|
|
||||||
get_wallpaper() {
|
get_wallpaper() {
|
||||||
case $os in
|
case $os in
|
||||||
"Mac OS X")
|
"Mac OS X"|"macOS")
|
||||||
image="$(osascript <<END
|
image="$(osascript <<END
|
||||||
tell application "System Events" to picture of current desktop
|
tell application "System Events" to picture of current desktop
|
||||||
END
|
END
|
||||||
|
@ -4031,7 +4033,7 @@ get_window_size() {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Get terminal width/height.
|
# Get terminal width/height.
|
||||||
if (( "${term_width:-0}" < 50 )) && [[ "$DISPLAY" && "$os" != "Mac OS X" ]]; then
|
if (( "${term_width:-0}" < 50 )) && [[ "$DISPLAY" && $os != "Mac OS X" && $os != "macOS" ]]; then
|
||||||
if type -p xdotool &>/dev/null; then
|
if type -p xdotool &>/dev/null; then
|
||||||
IFS=$'\n' read -d "" -ra win \
|
IFS=$'\n' read -d "" -ra win \
|
||||||
<<< "$(xdotool getactivewindow getwindowgeometry --shell %1)"
|
<<< "$(xdotool getactivewindow getwindowgeometry --shell %1)"
|
||||||
|
@ -4558,7 +4560,7 @@ cache() {
|
||||||
|
|
||||||
get_cache_dir() {
|
get_cache_dir() {
|
||||||
case $os in
|
case $os in
|
||||||
"Mac OS X") cache_dir="/Library/Caches" ;;
|
"Mac OS X"|"macOS") cache_dir="/Library/Caches" ;;
|
||||||
*) cache_dir="/tmp" ;;
|
*) cache_dir="/tmp" ;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue