Resolution: don't display disabled resolutions

This commit is contained in:
李通洲 2023-12-07 15:37:00 +08:00
parent ccd5d9f526
commit 326f9d652d
No known key found for this signature in database
GPG key ID: 269AD4F5325A22A3

View file

@ -3107,9 +3107,10 @@ get_resolution() {
resolution="$(xdpyinfo | awk '/dimensions:/ {printf $2}')"
elif [[ -d /sys/class/drm ]]; then
for dev in /sys/class/drm/*/modes; do
read -r single_resolution _ < "$dev"
for dev in /sys/class/drm/*; do
[[ $(<"$dev/enabled") != "enabled" ]] && continue
read -r single_resolution _ < "$dev/modes"
[[ $single_resolution ]] && resolution="${single_resolution}, ${resolution}"
done
fi