This commit is contained in:
Azalea 2023-08-10 13:13:50 -07:00
parent 391ff75cd1
commit 526c97fde6

View file

@ -3828,13 +3828,13 @@ get_resolution() {
if spdisplays_resolution="$(PlistBuddy -c "print 0:_items:${gpu}:spdisplays_ndrvs:${display}:_spdisplays_resolution" $temp_plist)" 2>/dev/null; then
spdisplays_resolution="${spdisplays_resolution//.[0-9][0-9]/}"
if spdisplays_pixels="$(PlistBuddy -c "print 0:_items:${gpu}:spdisplays_ndrvs:${display}:_spdisplays_pixels" $temp_plist)" 2>/dev/null; then
scaled_x="$(echo $spdisplays_resolution | awk '{print $1}')"
output_x="$(echo $spdisplays_pixels | awk '{print $1}')"
let scale_factor=$output_x/$scaled_x
[[ $scale_factor > 1 ]] && spdisplays_resolution="${spdisplays_resolution// @/ @${scale_factor}x @}"
scaled_x="$(echo "$spdisplays_resolution" | awk '{print $1}')"
output_x="$(echo "$spdisplays_pixels" | awk '{print $1}')"
(( scale_factor=output_x/scaled_x ))
[[ $scale_factor -gt 1 ]] && spdisplays_resolution="${spdisplays_resolution// @/ @${scale_factor}x @}"
fi
spdisplays_resolution="${spdisplays_resolution// x /x}"
[[ $gpu > 0 || $display > 0 ]] && resolution+=", "
[[ $gpu -gt 0 || $display -gt 0 ]] && resolution+=", "
resolution+="${spdisplays_resolution}"
else
break