From 326f9d652d8d732fc8b37c558191143bd2e1a5d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Thu, 7 Dec 2023 15:37:00 +0800 Subject: [PATCH] Resolution: don't display disabled resolutions --- neofetch | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/neofetch b/neofetch index 48b96d21..36c7ddbd 100755 --- a/neofetch +++ b/neofetch @@ -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