make it a wrapper function

This commit is contained in:
OldWorldOrdr 2023-09-25 23:44:28 -04:00
parent c77a05809e
commit c33c897724

View file

@ -49,8 +49,14 @@ LANG=C
[[ -z $GIO_EXTRA_MODULES ]] && export GIO_EXTRA_MODULES=/usr/lib/x86_64-linux-gnu/gio/modules/ [[ -z $GIO_EXTRA_MODULES ]] && export GIO_EXTRA_MODULES=/usr/lib/x86_64-linux-gnu/gio/modules/
# Use sed -r instead of sed -E if using GNU sed. # Use sed -r instead of sed -E if using GNU sed.
sed_ext='-E' [[ $(sed --version 2>/dev/null) =~ GNU ]] && gnu_sed=1
[[ $(sed --version 2>/dev/null) =~ GNU ]] && sed_ext='-r' sed() {
if [[ $gnu_sed ]]; then
command sed "${@//-E/-r}"
else
command sed "$@"
fi
}
# Neofetch default config. # Neofetch default config.
read -rd '' config <<'EOF' read -rd '' config <<'EOF'
@ -3596,7 +3602,7 @@ get_network() {
if [[ $ActiveNetworkName == "Wi-Fi" ]]; then if [[ $ActiveNetworkName == "Wi-Fi" ]]; then
LinkSpeed="$(/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -I | awk '/maxRate/{print}' | awk '{print $2}' )Mbps" LinkSpeed="$(/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -I | awk '/maxRate/{print}' | awk '{print $2}' )Mbps"
else else
LinkSpeed="$(ifconfig "$ActiveNetwork" | awk '/media/{print}' | sed "$sed_ext" "s/.*\((.*)\).*/\1/")" LinkSpeed="$(ifconfig "$ActiveNetwork" | awk '/media/{print}' | sed -E "s/.*\((.*)\).*/\1/")"
fi fi
network="$ActiveNetwork: $ActiveNetworkName@$LinkSpeed" network="$ActiveNetwork: $ActiveNetworkName@$LinkSpeed"
;; ;;
@ -5212,7 +5218,7 @@ print_ascii() {
strip_escape_codes "${line}" line strip_escape_codes "${line}" line
# Use patterns to replace color codes that the above line did not catch # Use patterns to replace color codes that the above line did not catch
line=${line//\\033\[*([0-9;])[JKmsu]/} line=${line//\\033\[*([0-9;])[JKmsu]/}
line="$(printf %b "$line" | sed "$sed_ext" 's/'"$(printf %b '\x1B')"'\[*[0-9;]+[JKmsu]//g')" line="$(printf %b "$line" | sed -E 's/'"$(printf %b '\x1B')"'\[*[0-9;]+[JKmsu]//g')"
((++lines,${#line}>ascii_len)) && ascii_len="${#line}" ((++lines,${#line}>ascii_len)) && ascii_len="${#line}"
done <<< "${ascii_data//\$\{??\}}" done <<< "${ascii_data//\$\{??\}}"
fi fi