[PR] dylanaraps/neofetch#2356 from CarterLi - Resolution (macOS): improve detection

Upstream PR: https://github.com/dylanaraps/neofetch/pull/2356
Thanks to @CarterLi

Co-authored-by: 李通洲 <zhangsongcui3371@sina.com>
This commit is contained in:
Azalea 2023-10-10 22:19:02 -04:00
commit afcf53f01f

View file

@ -3866,7 +3866,13 @@ get_resolution() {
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 @}"
if [[ $scale_factor -gt 1 ]]; then
if [[ "$spdisplays_resolution" == *"@"* ]]; then
spdisplays_resolution="${spdisplays_resolution// @/ @${scale_factor}x @}"
else
spdisplays_resolution="${spdisplays_resolution} @ ${scale_factor}x"
fi
fi
fi
spdisplays_resolution="${spdisplays_resolution// x /x}"
[[ $gpu -gt 0 || $display -gt 0 ]] && resolution+=", "