Misc: Use fallback values for some functions
This commit is contained in:
parent
fe3da7e0b8
commit
def8123c46
92
neofetch
92
neofetch
|
@ -1173,7 +1173,16 @@ get_gpu() {
|
|||
esac
|
||||
;;
|
||||
|
||||
"BSD" | "Solaris" | "MINIX" | "AIX")
|
||||
"Windows")
|
||||
gpu="$(wmic path Win32_VideoController get caption)"
|
||||
gpu="${gpu//Caption}"
|
||||
;;
|
||||
|
||||
"Haiku")
|
||||
gpu="$(listdev | grep -A2 -F 'device Display controller' | awk -F':' '/device beef/ {print $2}')"
|
||||
;;
|
||||
|
||||
*)
|
||||
case "$kernel_name" in
|
||||
"FreeBSD"* | "DragonFly"*)
|
||||
gpu="$(pciconf -lv | grep -B 4 -F "VGA" | grep -F "device")"
|
||||
|
@ -1187,15 +1196,6 @@ get_gpu() {
|
|||
;;
|
||||
esac
|
||||
;;
|
||||
|
||||
"Windows")
|
||||
gpu="$(wmic path Win32_VideoController get caption)"
|
||||
gpu="${gpu//Caption}"
|
||||
;;
|
||||
|
||||
"Haiku")
|
||||
gpu="$(listdev | grep -A2 -F 'device Display controller' | awk -F':' '/device beef/ {print $2}')"
|
||||
;;
|
||||
esac
|
||||
|
||||
if [[ "$gpu_brand" == "off" ]]; then
|
||||
|
@ -1394,19 +1394,6 @@ get_song() {
|
|||
|
||||
get_resolution() {
|
||||
case "$os" in
|
||||
"Linux" | "BSD" | "Solaris" | "MINIX" | "AIX")
|
||||
if type -p xrandr >/dev/null; then
|
||||
case "$refresh_rate" in
|
||||
"on") resolution="$(xrandr --nograb --current | awk 'match($0,/[0-9]*\.[0-9]*\*/) {printf $1 " @ " substr($0,RSTART,RLENGTH) "Hz, "}')" ;;
|
||||
"off") resolution="$(xrandr --nograb --current | awk '/\*/ {printf $1 ", "}')" ;;
|
||||
esac
|
||||
resolution="${resolution//\*}"
|
||||
|
||||
elif type -p xdpyinfo >/dev/null; then
|
||||
resolution="$(xdpyinfo | awk '/dimensions:/ {printf $2}')"
|
||||
fi
|
||||
;;
|
||||
|
||||
"Mac OS X")
|
||||
if type -p screenresolution >/dev/null; then
|
||||
resolution="$(screenresolution get 2>&1 | awk '/Display/ {printf $6 "Hz, "}')"
|
||||
|
@ -1451,6 +1438,19 @@ get_resolution() {
|
|||
|
||||
[[ "$refresh_rate" == "off" ]] && resolution="${resolution/ @*}"
|
||||
;;
|
||||
|
||||
*)
|
||||
if type -p xrandr >/dev/null; then
|
||||
case "$refresh_rate" in
|
||||
"on") resolution="$(xrandr --nograb --current | awk 'match($0,/[0-9]*\.[0-9]*\*/) {printf $1 " @ " substr($0,RSTART,RLENGTH) "Hz, "}')" ;;
|
||||
"off") resolution="$(xrandr --nograb --current | awk '/\*/ {printf $1 ", "}')" ;;
|
||||
esac
|
||||
resolution="${resolution//\*}"
|
||||
|
||||
elif type -p xdpyinfo >/dev/null; then
|
||||
resolution="$(xdpyinfo | awk '/dimensions:/ {printf $2}')"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
resolution="${resolution%,*}"
|
||||
|
@ -2192,7 +2192,29 @@ get_image_source() {
|
|||
|
||||
get_wallpaper() {
|
||||
case "$os" in
|
||||
"Linux" | "BSD" | "Solaris" | "MINIX" | "AIX")
|
||||
"Mac OS X")
|
||||
image="$(osascript -e 'tell application "System Events" to picture of current desktop')"
|
||||
;;
|
||||
|
||||
"Windows")
|
||||
case "$distro" in
|
||||
"Windows XP")
|
||||
case "$kernel_name" in
|
||||
"CYGWIN"*) image="/cygdrive/c/Documents and Settings/${USER}" ;;
|
||||
"MSYS2"* | "MINGW*") image="/c/Documents and Settings/${USER}" ;;
|
||||
esac
|
||||
image+="/Local Settings/Application Data/Microsoft"
|
||||
image+="/Wallpaper1.bmp"
|
||||
;;
|
||||
|
||||
"Windows"*)
|
||||
image="$APPDATA/Microsoft/Windows/Themes"
|
||||
image+="/TranscodedWallpaper.jpg"
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
|
||||
*)
|
||||
# Get DE if user has disabled the function.
|
||||
((de_run != 1)) && get_de
|
||||
|
||||
|
@ -2223,28 +2245,6 @@ get_wallpaper() {
|
|||
image="${image/'file://'}"
|
||||
image="$(trim_quotes "$image")"
|
||||
;;
|
||||
|
||||
"Mac OS X")
|
||||
image="$(osascript -e 'tell application "System Events" to picture of current desktop')"
|
||||
;;
|
||||
|
||||
"Windows")
|
||||
case "$distro" in
|
||||
"Windows XP")
|
||||
case "$kernel_name" in
|
||||
"CYGWIN"*) image="/cygdrive/c/Documents and Settings/${USER}" ;;
|
||||
"MSYS2"* | "MINGW*") image="/c/Documents and Settings/${USER}" ;;
|
||||
esac
|
||||
image+="/Local Settings/Application Data/Microsoft"
|
||||
image+="/Wallpaper1.bmp"
|
||||
;;
|
||||
|
||||
"Windows"*)
|
||||
image="$APPDATA/Microsoft/Windows/Themes"
|
||||
image+="/TranscodedWallpaper.jpg"
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
|
||||
# If image is an xml file, don't use it.
|
||||
|
|
Reference in New Issue