Merge pull request #711 from konimex/fallback
Misc: Use fallback values for some functions
This commit is contained in:
commit
55420c3c30
1 changed files with 46 additions and 46 deletions
92
neofetch
92
neofetch
|
@ -1173,7 +1173,16 @@ get_gpu() {
|
||||||
esac
|
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
|
case "$kernel_name" in
|
||||||
"FreeBSD"* | "DragonFly"*)
|
"FreeBSD"* | "DragonFly"*)
|
||||||
gpu="$(pciconf -lv | grep -B 4 -F "VGA" | grep -F "device")"
|
gpu="$(pciconf -lv | grep -B 4 -F "VGA" | grep -F "device")"
|
||||||
|
@ -1187,15 +1196,6 @@ get_gpu() {
|
||||||
;;
|
;;
|
||||||
esac
|
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
|
esac
|
||||||
|
|
||||||
if [[ "$gpu_brand" == "off" ]]; then
|
if [[ "$gpu_brand" == "off" ]]; then
|
||||||
|
@ -1394,19 +1394,6 @@ get_song() {
|
||||||
|
|
||||||
get_resolution() {
|
get_resolution() {
|
||||||
case "$os" in
|
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")
|
"Mac OS X")
|
||||||
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, "}')"
|
||||||
|
@ -1451,6 +1438,19 @@ get_resolution() {
|
||||||
|
|
||||||
[[ "$refresh_rate" == "off" ]] && resolution="${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
|
esac
|
||||||
|
|
||||||
resolution="${resolution%,*}"
|
resolution="${resolution%,*}"
|
||||||
|
@ -2192,7 +2192,29 @@ get_image_source() {
|
||||||
|
|
||||||
get_wallpaper() {
|
get_wallpaper() {
|
||||||
case "$os" in
|
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.
|
# Get DE if user has disabled the function.
|
||||||
((de_run != 1)) && get_de
|
((de_run != 1)) && get_de
|
||||||
|
|
||||||
|
@ -2223,28 +2245,6 @@ get_wallpaper() {
|
||||||
image="${image/'file://'}"
|
image="${image/'file://'}"
|
||||||
image="$(trim_quotes "$image")"
|
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
|
esac
|
||||||
|
|
||||||
# If image is an xml file, don't use it.
|
# If image is an xml file, don't use it.
|
||||||
|
|
Loading…
Reference in a new issue