fixed network module for macOS
This commit is contained in:
parent
1c2cee4cf5
commit
99a6fc0770
1 changed files with 10 additions and 0 deletions
10
neofetch
10
neofetch
|
@ -3286,6 +3286,16 @@ get_network() {
|
||||||
fi
|
fi
|
||||||
done < <(find /sys/class/net/ -type l)
|
done < <(find /sys/class/net/ -type l)
|
||||||
;;
|
;;
|
||||||
|
"Mac OS X"|"macOS")
|
||||||
|
ActiveNetwork=$(route get default | grep interface | awk '{print $2}')
|
||||||
|
ActiveNetworkName=$(networksetup -listallhardwareports | grep -B 1 "$ActiveNetwork" | awk '/Hardware Port/{ print }'|cut -d " " -f3-)
|
||||||
|
if [[ $ActiveNetworkName == "Wi-Fi" ]]; then
|
||||||
|
LinkSpeed="$(/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -I | awk '/maxRate/{ print }' | xargs | cut -d " " -f2)Mbps"
|
||||||
|
else
|
||||||
|
LinkSpeed="$(ifconfig $ActiveNetwork | grep 'media:' | gsed -E "s/.*\((.*)\).*/\1/gm")"
|
||||||
|
fi
|
||||||
|
network="$ActiveNetwork: $ActiveNetworkName@$LinkSpeed"
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
while IFS=' ' read -r n i; do
|
while IFS=' ' read -r n i; do
|
||||||
if [ -n "$i" ]; then
|
if [ -n "$i" ]; then
|
||||||
|
|
Loading…
Reference in a new issue