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
parent bb938979
...@@ -1540,14 +1540,18 @@ get_resolution() { ...@@ -1540,14 +1540,18 @@ get_resolution() {
awk '/Resolution:/ {printf $2"x"$4" @ "$6"Hz, "}')" awk '/Resolution:/ {printf $2"x"$4" @ "$6"Hz, "}')"
fi fi
scale_factor="$(PlistBuddy -c "Print DisplayAnyUserSets:0:0:Resolution" \ if [[ -e "/Library/Preferences/com.apple.windowserver.plist" ]]; then
/Library/Preferences/com.apple.windowserver.plist)" 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. # If no refresh rate is empty.
[[ "$resolution" == *"@ Hz"* ]] && \ [[ "$resolution" == *"@ Hz"* ]] && \
resolution="${resolution//@ Hz}" resolution="${resolution//@ Hz}"
((${scale_factor%.*} == 2)) && \ [[ "${scale_factor%.*}" == 2 ]] && \
resolution="${resolution// @/@2x @}" resolution="${resolution// @/@2x @}"
if [[ "$refresh_rate" == "off" ]]; then if [[ "$refresh_rate" == "off" ]]; then
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment