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
This commit is contained in:
parent
bb9389797f
commit
1ab898e944
6
neofetch
6
neofetch
|
@ -1540,14 +1540,18 @@ get_resolution() {
|
|||
awk '/Resolution:/ {printf $2"x"$4" @ "$6"Hz, "}')"
|
||||
fi
|
||||
|
||||
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
|
||||
|
|
Reference in New Issue