From 1ab898e94452232d550d5fe500235300d009d735 Mon Sep 17 00:00:00 2001 From: Andrew Titmuss Date: Wed, 18 Oct 2017 11:25:27 +1100 Subject: [PATCH] resolution: Fix errors on non-retina screens [macOS] Added a check to see if the plist file we use for checking the scale factor exists --- neofetch | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/neofetch b/neofetch index 5b561a73..8924c80f 100755 --- a/neofetch +++ b/neofetch @@ -1540,14 +1540,18 @@ get_resolution() { awk '/Resolution:/ {printf $2"x"$4" @ "$6"Hz, "}')" fi - scale_factor="$(PlistBuddy -c "Print DisplayAnyUserSets:0:0:Resolution" \ - /Library/Preferences/com.apple.windowserver.plist)" + if [[ -e "/Library/Preferences/com.apple.windowserver.plist" ]]; then + scale_factor="$(PlistBuddy -c "Print DisplayAnyUserSets:0:0:Resolution" \ + /Library/Preferences/com.apple.windowserver.plist)" + else + scale_factor="" + fi # If no refresh rate is empty. [[ "$resolution" == *"@ Hz"* ]] && \ resolution="${resolution//@ Hz}" - ((${scale_factor%.*} == 2)) && \ + [[ "${scale_factor%.*}" == 2 ]] && \ resolution="${resolution// @/@2x @}" if [[ "$refresh_rate" == "off" ]]; then