From 34876f7f9c7981e9d1aba7f8460389fe2c74ce4b Mon Sep 17 00:00:00 2001 From: inxi-svn Date: Fri, 8 Oct 2010 06:05:34 +0000 Subject: [PATCH] added handling for multiple res for multiple screens in special cases with multiple video cards --- inxi | 53 ++++++++++++++++++++++++++++++++++------------------- 1 file changed, 34 insertions(+), 19 deletions(-) diff --git a/inxi b/inxi index f555b20..06f7577 100755 --- a/inxi +++ b/inxi @@ -1,7 +1,7 @@ #!/bin/bash ######################################################################## #### Script Name: inxi -#### version: 1.4.19 +#### version: 1.4.20 #### Date: October 7 2010 ######################################################################## #### SPECIAL THANKS @@ -2465,31 +2465,46 @@ get_graphics_glx_data() get_graphics_res_data() { eval $LOGFS - local screen_resolution='' + local screen_resolution='' xdpy_data='' screens_count=0 if [[ $B_X_RUNNING == 'true' && $B_ROOT != 'true' ]];then # Added the two ?'s , because the resolution is now reported without spaces around the 'x', as in # 1400x1050 instead of 1400 x 1050. Change as of X.org version 1.3.0 - screen_resolution=$( xrandr | gawk ' - /\*/ { - res[++m] = gensub(/^.* ([0-9]+) ?x ?([0-9]+)[_ ].* ([0-9\.]+)\*.*$/,"\\1x\\2@\\3hz","g",$0) - } - END { - for (n in res) { - if (res[n] ~ /^[[:digit:]]+x[[:digit:]]+/) { - line = line ? line ", " res[n] : res[n] + xdpy_data="$( xdpyinfo )" + xdpy_count=$( grep -c 'dimensions' <<< "$xdpy_data" ) + # we get a bit more info from xrandr than xdpyinfo, but xrandr fails to handle + # multiple screens from different video cards + if [[ $xdpy_count -eq 1 ]];then + screen_resolution=$( xrandr | gawk ' + /\*/ { + res[++m] = gensub(/^.* ([0-9]+) ?x ?([0-9]+)[_ ].* ([0-9\.]+)\*.*$/,"\\1x\\2@\\3hz","g",$0) + } + END { + for (n in res) { + if (res[n] ~ /^[[:digit:]]+x[[:digit:]]+/) { + line = line ? line ", " res[n] : res[n] + } + } + if (line) { + print(line) } - } - if (line) { - print(line) - } - }' ) - if [[ -z $screen_resolution ]];then - screen_resolution=$( xdpyinfo | gawk ' - /dimensions/ { - print $2 }' ) fi + if [[ -z $screen_resolution || $xdpy_count -gt 1 ]];then + screen_resolution=$( gawk ' + BEGIN { + IGNORECASE=1 + screens = "" + separator = "" + } + /dimensions/ { + screens = screens $2 separator + separator = ", " + } + END { + print screens + }' <<< "$xdpy_data" ) + fi else screen_resolution=$( stty -F $( readlink /proc/$PPID/fd/0 ) size | gawk '{ print $2"x"$1